char IncomingValue = 0; void setup(){ Serial.begin(9600); pinMode(8, OUTPUT); } void loop(){ if(Serial.available() > 0){ IncomingValue = Serial.read(); Serial.println(IncomingValue); if(IncomingValue == '1') digitalWrite(8, HIGH); else if(IncomingValue == '0') digitalWrite(8, LOW); } }