Arduino: Use the button as a button - how it works
If you are programming with the Arduino, you can connect some switches and buttons. This practical tip shows you how to implement these correctly on the software side.
Arduino: Use the button as a button
Integrating a button instead of a switch in the Arduino is very easy.
- Connect the button to the Arduino like a normal button or switch.
- In the setup method, however, you define the button as a pull-up input. An example of this is the command »pinMode (3, INPUT_PULLUP);«.
- Now you can easily use the switch or button as a button. The Arduino redirects the signal via an internal pull-up resistor.
In the next practical tip, you will learn how to control LEDs with the Arduino.