1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-21 15:54:39 +01:00

Added Esplora readJoystickButton function to be consistent with Esplora readButton

This commit is contained in:
Tom Igoe 2012-12-23 23:05:29 -05:00
parent d7d78ff6a5
commit d8e5997328
3 changed files with 13 additions and 1 deletions

View File

@ -111,6 +111,15 @@ boolean _Esplora::readButton(byte ch) {
return (val > 512) ? HIGH : LOW; 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) { void _Esplora::writeRGB(byte r, byte g, byte b) {
writeRed(r); writeRed(r);
writeGreen(g); writeGreen(g);

View File

@ -21,7 +21,7 @@
#ifndef ESPLORA_H_ #ifndef ESPLORA_H_
#define ESPLORA_H_ #define ESPLORA_H_
#include "Arduino.h" #include <Arduino.h>
/* /*
* The following constants are used internally by the Esplora * The following constants are used internally by the Esplora
@ -142,6 +142,8 @@ public:
*/ */
boolean readButton(byte channel); boolean readButton(byte channel);
boolean readJoystickButton();
void writeRGB(byte red, byte green, byte blue); void writeRGB(byte red, byte green, byte blue);
void writeRed(byte red); void writeRed(byte red);
void writeGreen(byte green); void writeGreen(byte green);

View File

@ -16,6 +16,7 @@ readLightSensor KEYWORD2
readTemperature KEYWORD2 readTemperature KEYWORD2
readMicrophone KEYWORD2 readMicrophone KEYWORD2
readJoystickSwitch KEYWORD2 readJoystickSwitch KEYWORD2
readJoystickButton KEYWORD2
readJoystickX KEYWORD2 readJoystickX KEYWORD2
readJoystickY KEYWORD2 readJoystickY KEYWORD2
readAccelerometer KEYWORD2 readAccelerometer KEYWORD2