We are now at the stage where we have a better understanding of programming using the Arduino IDE. In this lesson, we will be going through how to use a button within our programs. This will allow us to progress and write complex programs. We will be using the built in button on the Multi Functional Shield, A1, but you can also wire up a button to this pin.
Push Buttons
The buttons on the MFS are push buttons, which are single pole - single throw. This means that when the button is pressed down, it is HIGH, and when released, it is LOW. But, what if we want to use this push button to turn an LED on or off? We would have to hold the button down so that the LED is on, and the moment we release the button, the LED will turn back off. This isn't very convenient because, for instance, we may need the LED to stay on constantly after the button is pressed and when pressed again, the LED turns off. This can digitally be programmed using Button States.