Instantly share code, notes, and snippets.

Embed
What would you like to do?
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