Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
int val = 0;
void setup() {
pinMode(2, HIGH);
void loop() {
if(Serial.available() > 0) {
val =;
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.