diff --git a/libraries/Esplora/Esplora.cpp b/libraries/Esplora/Esplora.cpp index 83df0d7dd..29c9e191a 100644 --- a/libraries/Esplora/Esplora.cpp +++ b/libraries/Esplora/Esplora.cpp @@ -111,6 +111,15 @@ boolean _Esplora::readButton(byte ch) { return (val > 512) ? HIGH : LOW; } +boolean _Esplora::readJoystickButton() { + if (readChannel(CH_JOYSTICK_SW) == 1023) { + return HIGH; + } else if (readChannel(CH_JOYSTICK_SW) == 0) { + return LOW; + } +} + + void _Esplora::writeRGB(byte r, byte g, byte b) { writeRed(r); writeGreen(g); diff --git a/libraries/Esplora/Esplora.h b/libraries/Esplora/Esplora.h index 74fa88b2b..4f5534552 100644 --- a/libraries/Esplora/Esplora.h +++ b/libraries/Esplora/Esplora.h @@ -21,7 +21,7 @@ #ifndef ESPLORA_H_ #define ESPLORA_H_ -#include "Arduino.h" +#include /* * The following constants are used internally by the Esplora @@ -141,6 +141,8 @@ public: * LOW if the button is pressed, and HIGH otherwise. */ boolean readButton(byte channel); + + boolean readJoystickButton(); void writeRGB(byte red, byte green, byte blue); void writeRed(byte red); diff --git a/libraries/Esplora/keywords.txt b/libraries/Esplora/keywords.txt index 02ba6607c..b225991f6 100644 --- a/libraries/Esplora/keywords.txt +++ b/libraries/Esplora/keywords.txt @@ -16,6 +16,7 @@ readLightSensor KEYWORD2 readTemperature KEYWORD2 readMicrophone KEYWORD2 readJoystickSwitch KEYWORD2 +readJoystickButton KEYWORD2 readJoystickX KEYWORD2 readJoystickY KEYWORD2 readAccelerometer KEYWORD2