hello, I have a problem with this program, if I run the command 1 and 2, the Arduino then interprets me both with the delay, but I want to recive the two impulses if followed in a second 1 and 2 do not interpret any. It is possible to do ?
Thanks
void setup() {
Serial.begin(9600);
for (int thisPin = 2; thisPin < 5; thisPin++) {
pinMode(thisPin, OUTPUT);
}
}
void loop() {
if (Serial.available() > 0) {
int inByte = Serial.read();
switch (inByte) {
case '1':
digitalWrite(2, HIGH);
delay(500);
digitalWrite(2, LOW);
break;
case '2':
digitalWrite(3, HIGH);
delay(500);
digitalWrite(3, LOW);
break;
case '3':
digitalWrite(4, HIGH);
delay(500);
digitalWrite(4, LOW);
break;
default:
for (int thisPin = 2; thisPin < 5; thisPin++) {
digitalWrite(thisPin, LOW);
}
}
}
}