File tree 3 files changed +13
-1
lines changed
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) {
111
111
return (val > 512 ) ? HIGH : LOW;
112
112
}
113
113
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
+
114
123
void _Esplora::writeRGB (byte r, byte g, byte b) {
115
124
writeRed (r);
116
125
writeGreen (g);
Original file line number Diff line number Diff line change 21
21
#ifndef ESPLORA_H_
22
22
#define ESPLORA_H_
23
23
24
- #include " Arduino.h"
24
+ #include < Arduino.h>
25
25
26
26
/*
27
27
* The following constants are used internally by the Esplora
@@ -141,6 +141,8 @@ class _Esplora {
141
141
* LOW if the button is pressed, and HIGH otherwise.
142
142
*/
143
143
boolean readButton (byte channel);
144
+
145
+ boolean readJoystickButton ();
144
146
145
147
void writeRGB (byte red, byte green, byte blue);
146
148
void writeRed (byte red);
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ readLightSensor KEYWORD2
16
16
readTemperature KEYWORD2
17
17
readMicrophone KEYWORD2
18
18
readJoystickSwitch KEYWORD2
19
+ readJoystickButton KEYWORD2
19
20
readJoystickX KEYWORD2
20
21
readJoystickY KEYWORD2
21
22
readAccelerometer KEYWORD2
You can’t perform that action at this time.
0 commit comments