Skip to content

Instantly share code, notes, and snippets.

@ArshSekhon
Created August 2, 2019 18:42
Show Gist options
  • Save ArshSekhon/adfdec29cef8f6a51cda90735c3201bf to your computer and use it in GitHub Desktop.
Save ArshSekhon/adfdec29cef8f6a51cda90735c3201bf to your computer and use it in GitHub Desktop.
#define LED_PIN 13
int ledStatus=0;
void setup() {
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, LOW);
Serial3.begin(9600);
}
void loop() {
if (Serial3.available() > 0){ //if the user has entered something in the serial monitor
ledStatus = Serial3.parseInt();
if(ledStatus==0)
digitalWrite(LED_PIN, LOW);
else if(ledStatus==1)
digitalWrite(LED_PIN, HIGH);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment