Skip to content

Instantly share code, notes, and snippets.

@mehulved
Created May 2, 2012 12:38
Show Gist options
  • Save mehulved/2576270 to your computer and use it in GitHub Desktop.
Save mehulved/2576270 to your computer and use it in GitHub Desktop.
Goes to high but doesn't return back to low
int led = 13;
char ledValue;
void setup() {
Serial.begin(9600);
Serial.println("Enter H to turn on the LED and L to turn it off");
}
void loop() {
Serial.println(digitalRead(led));
delay(1000);
}
void serialEvent() {
if (Serial.read() == 'H' || Serial.read() == 'h') {
digitalWrite(led, HIGH);
}
if (Serial.read() == 'L' || Serial.read() == 'l') {
digitalWrite(led, LOW);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment