-
-
Save surinoel/7def241800109a00ddf7dbd13d047b11 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
int pinLED = 13; | |
int ledStatus = 0; | |
void setup() { | |
// put your setup code here, to run once: | |
Serial.begin(115200); | |
pinMode(pinLED, OUTPUT); | |
Serial.println("usage : write (turn on | turn off)"); | |
} | |
void loop() { | |
// put your main code here, to run repeatedly: | |
digitalWrite(pinLED, ledStatus); | |
while(Serial.available() > 0) { | |
if(Serial.find("turn on")) { | |
Serial.println("turn on"); | |
ledStatus = 1; | |
} | |
else if(Serial.find("turn off")) { | |
Serial.println("turn off"); | |
ledStatus = 0; | |
} | |
else { | |
Serial.println("usage : write (turn on | turn off)"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment