Created
April 12, 2013 21:13
-
-
Save sjsd/5375179 to your computer and use it in GitHub Desktop.
This is a simple setup to use the serial console in the Arduino Enviroment software. See more details in this blog post http://sjsdlabs.tumblr.com/post/47807176974/serial-input
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); | |
for (int leds = 10; leds < 14; leds++) { | |
pinMode(leds, OUTPUT); | |
} | |
} | |
void loop (){ | |
if (Serial.available()) { | |
char ser = Serial.read(); | |
switch (ser) { | |
case '0': | |
trigger(10); | |
break; | |
case '1': | |
trigger(11); | |
break; | |
case '2': | |
trigger(12); | |
break; | |
case '3': | |
trigger(13); | |
break; | |
} | |
} | |
} | |
void trigger(int pin){ | |
digitalWrite(pin, HIGH); | |
delay(75); | |
digitalWrite(pin, LOW); | |
delay(75); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See more details in my this blog post http://sjsdlabs.tumblr.com/post/47807176974/serial-input