Multiple Button Switches - Easy & Effective Polling

An approach for Implementing many button switches using a simple but effective polling method.

Feb 15, 2021

12024 views

2 respects

Components and supplies

1

Tactile Switch, Top Actuated

1

Breadboard (generic)

1

Arduino UNO

1

Jumper wires (generic)

Apps and platforms

1

Arduino IDE

Project description

Code

Reading Multiple Buttons by Polling

c_cpp

This sketch will reliably read any number of button switches by polling each of them in turn. Once a button switch is pressed the main code loop will switch to user provided code to handle the purpose of the button press. This is controlled via a switch control struct(ure) and associated switch-case code. The sketch layout is straight forward and process code for each button can be added where indicated within the main loop, under the switch-case section. As provided out of the box (OOTB), the main loop switch-case handling code simply prints to the serial monitor the button number activated.

Comments

Only logged in users can leave comments

ronbentley1

0 Followers

0 Projects

0