//from Daily Duino example: http://dailyduino.com/archives/483 // Read data from the serial port and turn ON or OFF a light depending on the value char val; //Data received from the serial port int ledPin = 13; //Set value ledPin to pin 13 void setup(){ pinMode(ledPin, OUTPUT); //Sets pin as OUTPUT Serial.begin(9600); //opens serial port, sets data rate at 9600bps } void loop(){ if (Serial.available()){ //If data is available to read, val = Serial.read(); //read it and store it as val } if (val == 'H'){ //If H is recieved digitalWrite(ledPin, HIGH); //turn ON light } else { digitalWrite(ledPin, LOW); //If not leave light OFF } delay(25); }