I am making a beer pong table. The goal is to have 10 rows of LED's and 2 or 3 push buttons.
Button 1 is on the North side of the table and button 2 on the south side. The plan is when a ball lands in a cup the player will hit their push button. This will change the LED state from all on to a pattern of rows flashing LEDs. I hope to have 10 different patterns and the south side will flash in the opposite direction of the north side of the table.
I have been able to program the arduino to work with 1 button and 2 or more rows of LEDs. I can also program several rows with 1 button. But when I bring it all together nothing works.
Here is an example of what I think the program should look like
// declare 10 digital outputs, 3 outputs, 20 different functions
pinMode 1 -10 output
pinMode 1-3 input
int state 20
// here is were I start to loose it.
When button 1(North side) is pressed the first state function is called.
When button 1 is pressed again the second function is called
Pressing button 2 will start function 11. Which is the opposite of the first state.
I can get button 1 to count up but when I introduce button 2 the program doesn't see it.
Can anyone give me some direction on how to program.
- 2 counters counting at the same time.
- writing sub-routines