24 pushbuttons 24 LED's

Ok here is what I want to do I have 24 pushbuttons and 24 leds. The 24 push buttons are iluminated momentary pushbuttons. The buttons are set up in to two banks of 12. I want to select one button off one bank have it iluminate showing it is selected. When the button is selected I want the other bank of buttons to iluminat showing all buttons are active. If I press one of the 12 iluminated buttons I want that button to uniluminat showing it has been pressed.

Ok now here is the tricky part if I select more buttons they will un-illuminate showing they have been pressed. Now if I select another button on the other bank of 12 I want it to illuminate showing it is active. Once the button is selected it will turn on all the illuminated buttons on the other bank showing they are active.

But if I go back to the first button it will show me what buttons have been pressed.

I am not sure how to make the buttons have a sort of memory? I all so am not sure how to wire them all up to the Arduino Duemilnove. I may be able to put resistors on all the button an hook them up to a analog pin and keep track of the resistance change so that the program knows what button is pressed. But as for toggling the leds on an off not sure how to hook up the 24 leds to the output pins.

Any ideas???

Without sitting down and wiring it up for you, what it sounds like is you will need to work on your boolean algebra and utilise a few gates. 74 series Quad gate ICs (AND, OR, NAND and maybe some Inverters). You will require a couple of LED drivers also if you want 12 LED’s to light up without drawing the current that will fry your Arduino. You should be able to get what you want from Farnell, or any other component retailer. All you need to do is sit down and work out what you want, and scribble down a quick diagram to help you. Basically what you want is not hard, its just a matter of drawing the logic.

Heres a link to Digital Logic and Boolean Maths, it should be able to help you. I hope I am not over stepping the mark but I in no way am suggesting you dont know it, this is help if you dont. I am not trying to insult your intelligence.

http://computerscience.jbpub.com/ecoa/2e/Null03.pdf

Hope thats of help.

Risk

Without sitting down and wiring it up for you, what it sounds like is you will need to work on your boolean algebra and utilise a few gates.

They are momentary contact buttons and he wants to store configutations for the 12 different buttons on the first bank. To go your route, will require a state machine with at least 144 flip-flops and a it will be a horrible, tedious design and assembly process. In the link you provided, Sequential logic starts on page 22. I suggest you read and and then decide if you really think that's a good idea in this sitation over a microcontroller.

Arduino is probably a good route to go, code should be fairly simple, and wiring almost trivial. Code will be store the LED states in an integer array (1 integer = 1 bank of 12), keep track of which bank is active, read the buttons and update the states.

No problem with what your saying, you are correct. It will still require some basic understanding of gates, for the code. I agree with you totally, I wouldnt want to have to wire it up as per my suggestion. Building a 24 Hr Alarm clock out of gates was bad enough that Id certainly take the uC route any day.

Logic “gates” is a bit of an abstraction to begin with to help a person implement simple combinational circuits where each gate is a physical bit of silicon to be wired in. I think to try and visualize gates for this coding will just confuse a novice programmer.

I don’t think that sort of logic applies to a clean high-level software implementation of what the original poster wants. For example, if button x on bank one is pushed, I’d basically do:

currentSet = x;
displayBank2(currentSet);

And for bank 2 buttons:

bank2[currentSet][x] = !bank2[currentSet][x];
displayBank2(currentSet);

This is very rough and probably doesn’t quite do what the OP wanted, but you get the idea. Gate-level logic simply does not apply here.