Hide minor edits - Show changes to markup
| SWITCH_1 or SWITCH_DOWN |
| SWITCH_2 or SWITCH_LEFT |
| SWITCH_3 or SWITCH_UP |
| SWITCH_4 or SWITCH_RIGHT |
| JOYSTICK_DOWN = JOYSTICK_BASE |
| JOYSTICK_LEFT = JOYSTICK_BASE+1 |
| JOYSTICK_UP = JOYSTICK_BASE+2 |
| JOYSTICK_RIGHT = JOYSTICK_BASE+3 |
if(button == HIGH)
if(button == LOW)
readButton(button)
Esplora.readButton(button)
Read the button state and returns if it is HIGH or LOW. Passing the parameter associated to the button will give the state of the button.
Reads a button's state and returns if it is HIGH or LOW.
readButton(channel)
readButton(button)
channel: the associated button that you wanto read. Valid argument are:
button: the associated button that you wanto read. Valid argument are:
return the state of the interrogated button. It could be HIGH or LOW.
[@
(:source lang=arduino tabwidth=4:)
@]
(:sourceend:)
Read the button state and returns if it is HIGH or LOW. Passing the parameter associated to the button will give the state of the button.
readButton(channel)
channel: the associated button that you wanto read. Valid argument are:
return the state of the interrogated button. It could be HIGH or LOW.
#include <Esplora.h>
void setup(){}
void loop()
{
int button = Esplora.readButton(SWITCH_DOWN);
if(button == HIGH)
{
Esplora.writeRed(255);
}
else {
Esplora.writeRed(0);
}
}