Skip to content

Instantly share code, notes, and snippets.

@Danushka96
Created September 22, 2019 03:38
Show Gist options
  • Save Danushka96/1a87fc726d7344bcd87c5ade93d8c91a to your computer and use it in GitHub Desktop.
Save Danushka96/1a87fc726d7344bcd87c5ade93d8c91a to your computer and use it in GitHub Desktop.
char data = 0;
void setup() {
// put your setup code here, to run once:
pinMode(12,OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
if(Serial.available() > 0){
data = Serial.read();
if(data=='1'){
digitalWrite(12,HIGH);
}else if(data=='2'){
digitalWrite(12,LOW);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment