Skip to content

Instantly share code, notes, and snippets.

@lvidarte
Created December 13, 2014 23:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lvidarte/52509fe846d4508ac3e7 to your computer and use it in GitHub Desktop.
Save lvidarte/52509fe846d4508ac3e7 to your computer and use it in GitHub Desktop.
char c;
int led = 4;
int counter = 0;
void setup()
{
Serial.begin(57600);
pinMode(led, OUTPUT);
}
void loop()
{
while (Serial.available() > 0) {
c = Serial.read();
Serial.print(c);
if (c == 't') {
digitalWrite(led, (counter++ % 2 == 0) ? HIGH : LOW);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment