Right now I can do this with a lot of relays but would like to use the Arduino to make it easier to maintenance. Can this be programmed to work on a mega1280- Digital I/O?
This is the only way I can explain it.
7 switches
7 red led
7 green led
1 relay (with two latching coils)
Seven counts (start at 0 then as switch is pressed and released -add one- next time the same switch is pressed and released -subtract one- from that switch's count)
If a switch is in the 0 count (state) then the switches corresponding red light goes HIGH green goes LOW
If a switch is in the 1 count (state) then the switches corresponding green light goes HIGH red goes LOW
Check to see if total count is 7
If less than 7 keep checking
Else pulse relay coil1 to latch, set all switch counts to 0 and after 120 second pulse relay coil2 to latch
The logic you request is easy and can be done on any Arduino, even the duemilanove, no need for the mega1280. You need quite a lot of input and output lines, so it might be worth to invest in two 74hc595 serial shift out IC to drive your leds and one 74HC165 parallel to serial shift in IC for your 7 buttons. That will set you back less then $5.
For the 7 keys you can also encode them with a few resistors and read them with an analogue input port.
For your coil you're going to need some transistor to drive it.
As your timing requirements seem to be more of the order of seconds and not µs, the whole thing is rather simple.
Thanks for the info! I have found code examples for the 595. No luck on the 156; is it similar to the example with a CD4021BE (http://www.arduino.cc/en/Tutorial/ShiftIn)?
what is the simplest way to modify this code so the LEDs stay on when i press and release the buttons? Also, how can I check to see if seven of the 8 are on?
I'm not asking for someone to write the code for me (would like to figure this out on my own) just give me ideas. I am not that great at programing so any code examples will help. THANKS!