const int LED = 10; char message; void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(LED,OUTPUT); } void loop() { // put your main code here, to run repeatedly: if (Serial.available() > 0){ message = Serial.read(); if (message == '1'){ digitalWrite(LED,HIGH); delay(100); } else if (message =='0'){ digitalWrite(LED,LOW); delay(100); } } }