Last active
January 3, 2019 19:36
-
-
Save shockwaves/a4ace3401e2f4251e01de26b45eef8f6 to your computer and use it in GitHub Desktop.
arduino-serial-io
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() { | |
String lolkek = Serial.readString(); | |
lolkek.trim(); | |
if (lolkek == "on") { | |
digitalWrite(LED_BUILTIN, HIGH); | |
} | |
if (lolkek == "off") { | |
digitalWrite(LED_BUILTIN, LOW); | |
} | |
if(lolkek.length() > 0) { | |
Serial.println(lolkek); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment