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

Hi awesome backer,

Thanks again for supporting us on Kickstarter or Indiegogo.

On this website you can access the learning videos and documentation. You'll need to sign up for an account but it shouldn't take long and allows us to remember your video progress so you don't have to keep track of that.

We hope you have a great time learning with Awesome Shield.


Close Message