Created
August 4, 2018 16:20
-
-
Save lol97/3d91212dd5f4d684f47a430588792eaa to your computer and use it in GitHub Desktop.
Simple ON-OFF LED BUILT IN Arduino from serial monitor
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
#define LED 13 | |
void setup() { | |
// put your setup code here, to run once: | |
pinMode(LED,OUTPUT); | |
Serial.begin(9600); | |
} | |
void loop() { | |
// put your main code here, to run repeatedly: | |
if(Serial.available()>0){ | |
char cmd = Serial.read(); | |
if(cmd == 'H'){ | |
digitalWrite(LED,HIGH); | |
} | |
else if(cmd=='L'){ | |
digitalWrite(LED,LOW); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment