Created
September 27, 2016 18:01
-
-
Save elktros/255cf96803a6056e9aeedfb4f0dfc2e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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