How can I do a program that when I push the boton 1, then boton2, then boton 3, turn on a LED conected in digital port.
thank you
regards
You need to keep track of whether or not each switch has been pressed. If the order matters, then you need to reset when a switch is pressed out of order.
But how I keep track of whether or not each switch has been pressed.
But how I keep track of whether or not each switch has been pressed.
boolean swOnePressed = false;
boolean swTwoPressed = false;
boolean swThreePressed = false;
void loop()
{
int swStateOne = digitalRead(swPinOne);
int swStateTwo = digitalRead(swPinTwo);
int swStateThree = digitalRead(swPinThree);
if(swStateOne == HIGH)
swOnePressed = true;
// Repeat for other switches
}
If the order matters, you need to test each swXxxPressed variable before setting the others.
ok thank you I'll do it tomorro and I say you
regards