char inVal = 0; int ledPin=7; void setup() { Serial.begin(9600); pinMode(ledPin, OUTPUT); } void loop() { if(Serial.available() > 0) { inVal = Serial.read(); Serial.println(inVal); //Serial.print("\n"); if(inVal == '1') digitalWrite(ledPin, HIGH); else if(inVal == '0') digitalWrite(ledPin, LOW); } }