Skip to content

Instantly share code, notes, and snippets.

@lol97
Created August 4, 2018 16:20
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 lol97/3d91212dd5f4d684f47a430588792eaa to your computer and use it in GitHub Desktop.
Save lol97/3d91212dd5f4d684f47a430588792eaa to your computer and use it in GitHub Desktop.
Simple ON-OFF LED BUILT IN Arduino from serial monitor
#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