Button

Button 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

// Turns the LED on if button is pressed if ( awesome.button.isDown() ) { awesome.LED.turnOn(); }

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

// Turns the LED on if button is not pressed if ( awesome.button.isUp() ) { awesome.LED.turnOn(); }

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

awesome.button.print();

Tips

The button is helpful as a simple input. It works really nicely with if().

x

Goodbye and thanks for all the fish,

Thanks for helping us Kickstart Awesome Shield and learning with us. Sadly, turning Awesome Shield into a sustainable business didn’t work out and so we’re in the process of officially shutting down the company.

Read our full letter.

If you have an Awesome Shield you can keep using it and the learning platform.


Close Message