Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d8e5997

Browse filesBrowse files
committed
Added Esplora readJoystickButton function to be consistent with Esplora readButton
1 parent d7d78ff commit d8e5997
Copy full SHA for d8e5997

File tree

Expand file treeCollapse file tree

3 files changed

+13
-1
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+13
-1
lines changed

‎libraries/Esplora/Esplora.cpp

Copy file name to clipboardExpand all lines: libraries/Esplora/Esplora.cpp
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
114123
void _Esplora::writeRGB(byte r, byte g, byte b) {
115124
writeRed(r);
116125
writeGreen(g);

‎libraries/Esplora/Esplora.h

Copy file name to clipboardExpand all lines: libraries/Esplora/Esplora.h
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
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);

‎libraries/Esplora/keywords.txt

Copy file name to clipboardExpand all lines: libraries/Esplora/keywords.txt
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ readLightSensor KEYWORD2
1616
readTemperature KEYWORD2
1717
readMicrophone KEYWORD2
1818
readJoystickSwitch KEYWORD2
19+
readJoystickButton KEYWORD2
1920
readJoystickX KEYWORD2
2021
readJoystickY KEYWORD2
2122
readAccelerometer KEYWORD2

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.