Last active
December 23, 2015 12:29
-
-
Save DILL44/6635370 to your computer and use it in GitHub Desktop.
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(13, OUTPUT); | |
} | |
void loop() { | |
if (Serial.available() > 0) { // if there is data coming from the serial port | |
int data = (int)Serial.read(); // get that data and print it | |
Serial.println(data); | |
if (data == 1) { // do what you want with this data | |
digitalWrite(13, HIGH); | |
} | |
else if(data == 2){ | |
digitalWrite(13, HIGH); | |
delay(1000); | |
digitalWrite(13, LOW); | |
} | |
else if(data == 3){ | |
while(1){ | |
digitalWrite(13, HIGH); | |
delay(1000); | |
digitalWrite(13, LOW); | |
delay(1000); | |
} | |
} | |
else{ | |
digitalWrite(13, LOW); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment