Skip to content

Instantly share code, notes, and snippets.

@ugeugeHigh
Created October 23, 2018 13:35
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 ugeugeHigh/bfd0e841e1792ba958efb8f22ebf8f72 to your computer and use it in GitHub Desktop.
Save ugeugeHigh/bfd0e841e1792ba958efb8f22ebf8f72 to your computer and use it in GitHub Desktop.
int val = 0;
void setup() {
Serial.begin(9600);
pinMode(2, HIGH);
}
void loop() {
if(Serial.available() > 0) {
val = Serial.read();
if(val == 48){
digitalWrite(2, LOW);
Serial.println("LED OFF");
}else if(val = 49){
digitalWrite(2, HIGH);
Serial.println("LED ON");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment