Skip to content

Instantly share code, notes, and snippets.

@panchiga
Last active August 29, 2015 14:26
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 panchiga/db897190caa2e0f28690 to your computer and use it in GitHub Desktop.
Save panchiga/db897190caa2e0f28690 to your computer and use it in GitHub Desktop.
void setup(){
Serial.begin(9600);
pinMode(2, OUTPUT);
pinMode(4, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
}
void loop(){
int inputchar;
inputchar = Serial.read();
if(inputchar != -1 ){
switch(inputchar){
case '2':
high_low(2);
break;
case '4':
high_low(4);
break;
case '7':
high_low(7);
break;
case '8':
high_low(8);
break;
}
}
else{ }
}
void high_low(int pin){
digitalWrite(pin, HIGH);
delay(200);
digitalWrite(pin, LOW);
delay(100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment