Documentos de Académico
Documentos de Profesional
Documentos de Cultura
3:00-4:00 pm
Integrantes:
Código Arduino 1:
#include "GFButton.h"
int pinBotonON = 8;
int pinBotonOFF = 9;
GFButton boton1(pinBotonON);
GFButton boton2(pinBotonOFF);
void setup() {
pinMode(pinBotonON, INPUT);
pinMode(pinBotonOFF, INPUT);
boton1.setPressHandler(botonON_pulsado);
boton2.setPressHandler(botonOFF_pulsado);
Serial.begin(9600);
}
void loop() {
boton1.process();
boton2.process();
}
void setup() {
pinMode(8, OUTPUT);
Serial.begin(9600);
inputString.reserve(200);
}
void loop() {
if (stringComplete) {
if (inputString == "LED1ON_") {
digitalWrite(8, HIGH);
}
else if (inputString == "LED1OFF_") {
digitalWrite(8, LOW);
}
inputString = "";
stringComplete = false;
}
}
void serialEvent() {
while (Serial.available()) {
char inChar = (char)Serial.read();
inputString += inChar;
if (inChar == '_') {
stringComplete = true;
}
}
}
Circuito físico: