Created
July 10, 2022 19:45
-
-
Save upsilun/fa47c6741f1745a851c7e1a0d0320d7b to your computer and use it in GitHub Desktop.
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() | |
{ | |
pinMode(13, OUTPUT); | |
Serial.begin(9600); | |
while (!Serial); | |
Serial.println("Input 1 to Turn LED on and 2 to off"); | |
} | |
void loop() { | |
if (Serial.available()) | |
{ | |
int state = Serial.parseInt(); | |
if (state == 1) | |
{ | |
digitalWrite(13, HIGH); | |
Serial.println("Command completed LED turned ON"); | |
} | |
if (state == 2) | |
{ | |
digitalWrite(13, LOW); | |
Serial.println("Command completed LED turned OFF"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment