File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed
Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,15 @@ boolean _Esplora::readButton(byte ch) {
111111 return (val > 512 ) ? HIGH : LOW;
112112}
113113
114+ boolean _Esplora::readJoystickButton () {
115+ if (readChannel (CH_JOYSTICK_SW) == 1023 ) {
116+ return HIGH;
117+ } else if (readChannel (CH_JOYSTICK_SW) == 0 ) {
118+ return LOW;
119+ }
120+ }
121+
122+
114123void _Esplora::writeRGB (byte r, byte g, byte b) {
115124 writeRed (r);
116125 writeGreen (g);
Original file line number Diff line number Diff line change 2121#ifndef ESPLORA_H_
2222#define ESPLORA_H_
2323
24- #include " Arduino.h"
24+ #include < Arduino.h>
2525
2626/*
2727 * The following constants are used internally by the Esplora
@@ -141,6 +141,8 @@ class _Esplora {
141141 * LOW if the button is pressed, and HIGH otherwise.
142142 */
143143 boolean readButton (byte channel);
144+
145+ boolean readJoystickButton ();
144146
145147 void writeRGB (byte red, byte green, byte blue);
146148 void writeRed (byte red);
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ readLightSensor KEYWORD2
1616readTemperature KEYWORD2
1717readMicrophone KEYWORD2
1818readJoystickSwitch KEYWORD2
19+ readJoystickButton KEYWORD2
1920readJoystickX KEYWORD2
2021readJoystickY KEYWORD2
2122readAccelerometer KEYWORD2
You can’t perform that action at this time.
0 commit comments