Button
The button is a simple switch. When the button is pressed down, it makes an electrical connection. The Arduino can detect this electrical connection and tell if the button is down.
Functions
awesome.button.isDown()
Checks if the button is currently down, meaning it is being pressed.
Returns
It returns a bool
. This bool
is true
if the button is down and false
if it is up.
Example
Advanced Functions
awesome.button.isUp()
The isUp()
function works a lot like the isDown()
function, but tells you when the button is up.
Returns
It returns a bool
. This bool is true
if the button is up and false
if it is down.
Example
awesome.button.print()
First the print function takes a reading from the button to see if it is up or down. Then it sends a message telling you whether the button is up or down through the Serial connection.
Click the magnifying glass icon in the top right hand corner of the Arduino IDE to see the messages that Arduino sends to you through the Serial connection.
Example
Tips
The button is helpful as a simple input. It works really nicely with if()
.