Last active
August 23, 2020 11:45
-
-
Save sankarcheppali/f558eccfe1e51ffe1564c6be231f1060 to your computer and use it in GitHub Desktop.
control arduino on board led using serial api
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
void setup() { | |
Serial.begin(9600); | |
pinMode(LED_BUILTIN, OUTPUT); | |
} | |
void loop() { | |
int cmd = Serial.parseInt(); | |
if(cmd == 1){ | |
digitalWrite(LED_BUILTIN, HIGH); | |
}else if (cmd == -1){ | |
digitalWrite(LED_BUILTIN, LOW); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment