#define LED_SERIAL_PIN 13
void setup() {
// put your setup code here, to run once:
pinMode(LED_SERIAL_PIN, OUTPUT);
Serial.begin(9600);
Serial.println("Arduino Control of LED using a Serial Monitor");
}
void loop() {
// put your main code here, to run repeatedly:
char input = '\0';
if (Serial.available()) {
input = Serial.read();
}
switch (input) {
case '1':
digitalWrite(LED_SERIAL_PIN, HIGH);
break;
case '0':
digitalWrite(LED_SERIAL_PIN, LOW);
break;
default:
break;
}
}