Skip to content

Instantly share code, notes, and snippets.

@elktros
Created September 27, 2016 18:01
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 elktros/255cf96803a6056e9aeedfb4f0dfc2e8 to your computer and use it in GitHub Desktop.
Save elktros/255cf96803a6056e9aeedfb4f0dfc2e8 to your computer and use it in GitHub Desktop.
const int led = 12;
char data = 0;
void setup()
{
Serial.begin(9600);
pinMode(led, OUTPUT);
}
void loop()
{
if(Serial.available() > 0)
{
data = Serial.read();
if(data == '1')
digitalWrite(led, HIGH);
else if(data == '0')
digitalWrite(led, LOW);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment