Created
November 4, 2014 08:37
-
-
Save francis2110/7138aba38a819352ddf1 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 ledPin=38, ledPin1=39,ledsONOFF=0, baudRate=9600; | |
//blue led on=1, off=0 | |
//red led on=3, off=2 | |
void setup(){ | |
pinMode(ledPin,OUTPUT); | |
pinMode(ledPin1,OUTPUT); | |
Serial.begin(baudRate); | |
} | |
void loop(){ | |
if(Serial.available()>0){ | |
int ledsONFF=Serial.read(); | |
if(ledsONFF==0){ | |
digitalWrite(ledPin,LOW); | |
} | |
else if(ledsONFF==1){ | |
digitalWrite(ledPin,HIGH); | |
} | |
else if(ledsONFF==2){ | |
digitalWrite(ledPin1,LOW); | |
} | |
else if(ledsONFF==3){ | |
digitalWrite(ledPin1,HIGH); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment