If you have a lot of button inputs for a project, keeping track of them (whether theyรขโฌโขre pressed, just pressed or just released) and debouncing can get a bit hairy. here is some sample code that will keep track of as many buttons as youรขโฌโขd like. The example shows 6. To change the pins or number of buttons, just put them in the array called รขโฌลbuttonsรขโฌย and the rest of the code will automatically adjust. (The code is in Arduino-ese but its pretty much just straight up C) Enjoy!
ADVERTISEMENT