Create a gist now

Instantly share code, notes, and snippets.

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