Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.