//read a signal over serial line and blink and LED based when charcter "A" is recieved //10/27/2008 BitMonkey Labs // int outputPin=13; int LEDstate=LOW; int inByte; void ToggleLEDstate() { if(LEDstate==LOW) { LEDstate=HIGH; } else { LEDstate=LOW; } //NOTE: start looking at BITWISE operators to figure out how to do this stuff more efficiently } void setup() { pinMode(outputPin, OUTPUT); digitalWrite(outputPin, LEDstate); Serial.begin(57600); } void loop() { if(Serial.available()>0) //check if any data came in on the serial port { inByte=Serial.read(); //read on byte of info if(inByte=='A') { ToggleLEDstate(); digitalWrite(outputPin, LEDstate); } } }