apuntes_Arduino/serialCom/serial2/serial2.ino

24 lines
476 B
Arduino
Raw Normal View History

2021-01-05 00:15:16 -03:00
void setup() {
pinMode(3, OUTPUT);
Serial.begin(9600);
}
void loop() {
if (Serial.available() > 0) {
int input = Serial.read();
if (input == '1') {
digitalWrite(3, HIGH);
String output = "Encendido @";
output += millis();
output += "ms";
Serial.println(output);
} else {
digitalWrite(3, LOW);
String output = "Apagado @";
output += millis();
output += "ms";
Serial.println(output);
}
}
}