Skip to content

Instantly share code, notes, and snippets.

@sjsd
Created April 12, 2013 21:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sjsd/5375179 to your computer and use it in GitHub Desktop.
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
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);
}
@sjsd
Copy link
Author

sjsd commented Apr 12, 2013

See more details in my this blog post http://sjsdlabs.tumblr.com/post/47807176974/serial-input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment