Re: Reading the state of Peggy2 tactile switches…

Home Evil Mad Scientist Forums LED Matrix Kits Reading the state of Peggy2 tactile switches… Re: Reading the state of Peggy2 tactile switches…

#21375
Windell Oskay
Keymaster

The peggy_life.pde program (linked on that page) has a user interface constructed with the buttons, and you can refer to that for an example. 

Essentially, they are read like any other button inputs on an Arduino (or Arduino compatible) board:  You configure the relevant inputs as inputs with an internal pull-up.  Poll the inputs, and determine if they are high or low.  If the input is low, then the button is currently being pressed.
The Peggy2_bounce program included with the Peggy library has a simpler example as well, for just a single one of the buttons.   For reference, that button is S2, on AVR pin B0 (aka Arduino pin Digital 8). Buttons b1 through b5 are on AVR pins C0 through C4 (aka Arduino pins Digital 14 through Digital 18).