Skip to content

Instantly share code, notes, and snippets.

@shockwaves
Last active January 3, 2019 19:36
Show Gist options
  • Save shockwaves/a4ace3401e2f4251e01de26b45eef8f6 to your computer and use it in GitHub Desktop.
Save shockwaves/a4ace3401e2f4251e01de26b45eef8f6 to your computer and use it in GitHub Desktop.
arduino-serial-io
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