Two switches pressed in series, and activate different out port?

Newbee here…

I wonder if its possible to use two switches and activate either out-port 1 or 2?
You have button 1 and button 2. (momentary)
If you first press no. 1 and release, then within 2 seconds press number 2 and release, it trigger out-signal on one spesific port to run a motor for 30 sec. Clockwise.
Then if you change order of activating buttons: first 2, release and then 1, it trigger another out-signal to run motor 30 sec. Counter-clockwise.

If you press both at the same time when motor is running, it should stop.

Is this something that could be done?

I am thinking of using a capasitiv prox to “feel my hand motion” and if I do a hand-gesture of running my hand past the sensors in one direction the curtains go down…
And “wave” the other way, the curtains go up.

Any comments?
I have to look in to programming later… :slight_smile:
I need to get the Arduino home first, and start to experiment…


Is this something that could be done?


Record the fact that a button has been pressed and the time it occurred If nothing has happened within 2 seconds forget the keypress. If the other button is pressed within 2 seconds act appropriately. Use millis() to do the timing.

ok, thanks for reply! Is there some software you know about that could be similar. ? Just so I can see some examples? :)


Start with the examples in the IDE and get comfortable with reading switches and turning outputs on and off. Look at the BlinkWithoutDelay example in the IDE to see how to use millis() for timing.

Start with your program by getting it to print in which order the buttons are pressed. don't do anything more until you have got that working then add timing and finally actions other than printing messages.

The demo several things at a time illustrates the use of millis() for timing.

The Thread planning and implementing a program may have some useful stuff.