18 #ifndef _ADAFRUIT_CIRCUITPLAYGROUND_H_ 19 #define _ADAFRUIT_CIRCUITPLAYGROUND_H_ 22 #include "utility/Adafruit_CPlay_Mic.h" 23 #include "utility/Adafruit_CPlay_NeoPixel.h" 24 #include "utility/Adafruit_CPlay_Speaker.h" 25 #include "utility/CP_Firmata.h" 28 #if defined(__AVR__) || \ 29 defined(ARDUINO_NRF52840_CIRCUITPLAY) // Circuit Playground 'classic' 30 #include "utility/CPlay_CapacitiveSensor.h" 32 #include "utility/Adafruit_CPlay_FreeTouch.h" 33 #include "utility/IRLibCPE.h" 36 #ifndef NOT_AN_INTERRUPT // Not defined in Arduino 1.0.5 37 #define NOT_AN_INTERRUPT -1 40 #ifdef __AVR__ // Circuit Playground 'classic' 41 #define CPLAY_CAPSENSE_SHARED 30 42 #define CPLAY_REDLED 13 43 #define CPLAY_NEOPIXELPIN 17 44 #define CPLAY_SLIDESWITCHPIN 21 45 #define CPLAY_LEFTBUTTON 4 46 #define CPLAY_RIGHTBUTTON 19 47 #define CPLAY_LIGHTSENSOR A5 48 #define CPLAY_THERMISTORPIN A0 49 #define CPLAY_SOUNDSENSOR A4 50 #define CPLAY_BUZZER 5 51 #define CPLAY_LIS3DH_CS 8 52 #define CPLAY_LIS3DH_INTERRUPT 7 53 #define CPLAY_LIS3DH_ADDRESS 0x18 54 #elif defined(ARDUINO_NRF52840_CIRCUITPLAY) 56 #define CPLAY_CAPSENSE_SHARED \ 58 #define CPLAY_LEFTBUTTON 4 59 #define CPLAY_RIGHTBUTTON 5 60 #define CPLAY_SLIDESWITCHPIN 7 61 #define CPLAY_NEOPIXELPIN 8 62 #define CPLAY_REDLED 13 63 #define CPLAY_BUZZER A0 64 #define CPLAY_LIGHTSENSOR A8 65 #define CPLAY_THERMISTORPIN A9 66 #define CPLAY_LIS3DH_CS -1 67 #define CPLAY_LIS3DH_INTERRUPT 27 68 #define CPLAY_LIS3DH_ADDRESS 0x19 69 #else // Circuit Playground Express 70 #define CPLAY_LEFTBUTTON 4 71 #define CPLAY_RIGHTBUTTON 5 72 #define CPLAY_SLIDESWITCHPIN 7 73 #define CPLAY_NEOPIXELPIN 8 74 #define CPLAY_REDLED 13 75 #define CPLAY_IR_EMITTER 25 76 #define CPLAY_IR_RECEIVER 26 77 #define CPLAY_BUZZER A0 78 #define CPLAY_LIGHTSENSOR A8 79 #define CPLAY_THERMISTORPIN A9 80 #define CPLAY_SOUNDSENSOR A4 81 #define CPLAY_LIS3DH_CS -1 82 #define CPLAY_LIS3DH_INTERRUPT 27 83 #define CPLAY_LIS3DH_ADDRESS 0x19 86 #define SERIESRESISTOR 10000 87 #define THERMISTORNOMINAL 10000 88 #define TEMPERATURENOMINAL \ 91 #define BCOEFFICIENT \ 100 #define LIGHT_SETTLE_MS 100 110 bool begin(uint8_t brightness = 20);
117 #if defined(__AVR__) || \ 118 defined(ARDUINO_NRF52840_CIRCUITPLAY) // Circuit Playground 'classic' or 122 Adafruit_CPlay_FreeTouch cap[7];
130 void playTone(uint16_t freq, uint16_t time,
bool wait =
true);
138 uint16_t
readCap(uint8_t p, uint8_t samples = 10);
166 lis.
setClick(c, clickthresh, 10, 20, 255);
241 void senseColor(uint8_t &red, uint8_t &green, uint8_t &blue);
253 uint8_t red, green, blue;
255 return ((uint32_t)red << 16) | ((uint32_t)green << 8) | blue;
void setPixelColor(uint8_t p, uint8_t r, uint8_t g, uint8_t b)
set the color of a neopixel on the board
Definition: Adafruit_Circuit_Playground.h:216
uint8_t gamma8(uint8_t x)
Get a gamma-corrected value from a gamma table.
Definition: Adafruit_Circuit_Playground.h:234
void setPixelColor(uint8_t p, uint32_t c)
set the color of a neopixel on the board
Definition: Adafruit_Circuit_Playground.h:197
void setBrightness(uint8_t)
Adjust output brightness. Does not immediately affect what's currently displayed on the LEDs...
Definition: Adafruit_CPlay_NeoPixel.cpp:2509
void clearPixels(void)
turn off all neopixels on the board
Definition: Adafruit_Circuit_Playground.h:183
Class that stores state and functions for interacting with Adafruit_LIS3DH.
Definition: Adafruit_CPlay_LIS3DH.h:344
uint8_t sine8(uint8_t x)
Get a sinusoidal value from a sine table.
Definition: Adafruit_Circuit_Playground.h:229
uint32_t colorWheel(uint8_t x)
get a color value from the color wheel.
Definition: Adafruit_CircuitPlayground.cpp:380
IRrecvPCI irReceiver
the IR receiver object
Definition: Adafruit_Circuit_Playground.h:123
float temperature(void)
read the onboard thermistor.
Definition: Adafruit_CircuitPlayground.cpp:338
bool isExpress(void)
check whether or not this device is a CircuitPlayground Express.
Definition: Adafruit_CircuitPlayground.cpp:442
Class that stores state and functions for the microphone on CircuitPlayground boards.
Definition: Adafruit_CPlay_Mic.h:26
Adafruit_CPlay_LIS3DH lis
the accelerometer object
Definition: Adafruit_Circuit_Playground.h:113
IRdecode irDecoder
the IR decoder object
Definition: Adafruit_Circuit_Playground.h:124
float motionX(void)
read the X parameter of the onboard accelerometer. Value returned is defined by setAccelRange().
Definition: Adafruit_CircuitPlayground.cpp:300
uint8_t getClick(void)
Get uint8_t for single or double click.
Definition: Adafruit_CPlay_LIS3DH.cpp:312
void setBrightness(uint16_t b)
set the global brightness of all neopixels.
Definition: Adafruit_Circuit_Playground.h:224
void setAccelRange(lis3dh_range_t range)
set the range of the MEMS accelerometer.
Definition: Adafruit_Circuit_Playground.h:154
void setRange(lis3dh_range_t range)
Sets the g range for the accelerometer.
Definition: Adafruit_CPlay_LIS3DH.cpp:321
uint16_t readCap(uint8_t p, uint8_t samples=10)
read capacitive touch sensor
Definition: Adafruit_CircuitPlayground.cpp:112
static uint8_t gamma8(uint8_t x)
An 8-bit gamma-correction function for basic pixel brightness adjustment. Makes color transitions app...
Definition: Adafruit_CPlay_NeoPixel.h:289
void setAccelTap(uint8_t c, uint8_t clickthresh)
turn on tap detection. Tap detection can detect single taps or 'double taps' (like a double-click)...
Definition: Adafruit_Circuit_Playground.h:165
bool rightButton(void)
read the right button
Definition: Adafruit_CircuitPlayground.cpp:199
Adafruit_CPlay_FreeTouch cap[7]
the array of capacitive touch sensors
Definition: Adafruit_Circuit_Playground.h:122
uint8_t getAccelTap(void)
test whether or not a tap has been detected
Definition: Adafruit_Circuit_Playground.h:176
Class that stores state and functions for interacting with CircuitPlayground hardware.
Definition: Adafruit_Circuit_Playground.h:108
Class that stores state and functions for the capacitive sensor on CircuitPlayground boards...
Definition: CPlay_CapacitiveSensor.h:34
void setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b)
Set a pixel's color using separate red, green and blue components. If using RGBW pixels, white will be set to 0.
Definition: Adafruit_CPlay_NeoPixel.cpp:2226
void clear(void)
Fill the whole NeoPixel strip with 0 / black / off.
Definition: Adafruit_CPlay_NeoPixel.cpp:2554
Adafruit_CircuitPlayground CircuitPlayground
instantiated by default
Definition: Adafruit_CircuitPlayground.cpp:451
float motionZ(void)
read the Z parameter of the onboard accelerometer. Value returned is defined by setAccelRange().
Definition: Adafruit_CircuitPlayground.cpp:326
void show(void)
Transmit pixel data in RAM to NeoPixels.
Definition: Adafruit_CPlay_NeoPixel.cpp:184
float temperatureF(void)
read the onboard thermistor.
Definition: Adafruit_CircuitPlayground.cpp:368
Adafruit_CPlay_Speaker speaker
the speaker object
Definition: Adafruit_Circuit_Playground.h:115
int16_t soundSensor(void)
read the onboard sound sensor. A reading of ~0 is silent, and loud audio will result in a reading bet...
Definition: Adafruit_CircuitPlayground.cpp:287
Adafruit_CPlay_Mic mic
the microphone object
Definition: Adafruit_Circuit_Playground.h:114
void redLED(bool v)
turn on or off the red LED on pin #13
Definition: Adafruit_CircuitPlayground.cpp:169
static uint8_t sine8(uint8_t x)
An 8-bit integer sine wave function, not directly compatible with standard trigonometric units like r...
Definition: Adafruit_CPlay_NeoPixel.h:275
uint32_t senseColor()
detect a color using the onboard light sensor
Definition: Adafruit_Circuit_Playground.h:250
Class that stores state and functions for the speaker on CircuitPlayground boards.
Definition: Adafruit_CPlay_Speaker.h:18
bool slideSwitch(void)
read the slide switch
Definition: Adafruit_CircuitPlayground.cpp:179
void setClick(uint8_t c, uint8_t clickthresh, uint8_t timelimit=10, uint8_t timelatency=20, uint8_t timewindow=255)
Set INT to output for single or double click.
Definition: Adafruit_CPlay_LIS3DH.cpp:281
Adafruit_CPlay_NeoPixel strip
the neopixel strip object
Definition: Adafruit_Circuit_Playground.h:112
void playTone(uint16_t freq, uint16_t time, bool wait=true)
play a tone on the onboard buzzer
Definition: Adafruit_CircuitPlayground.cpp:215
IRsend irSend
the IR send object
Definition: Adafruit_Circuit_Playground.h:125
float motionY(void)
read the Y parameter of the onboard accelerometer. Value returned is defined by setAccelRange().
Definition: Adafruit_CircuitPlayground.cpp:313
lis3dh_range_t
Definition: Adafruit_CPlay_LIS3DH.h:311
Class that stores state and functions for interacting with Adafruit NeoPixels and compatible devices...
Definition: Adafruit_CPlay_NeoPixel.h:200
bool leftButton(void)
read the left button
Definition: Adafruit_CircuitPlayground.cpp:189
uint16_t lightSensor(void)
read the onboard lightsensor
Definition: Adafruit_CircuitPlayground.cpp:276
bool begin(uint8_t brightness=20)
Set up the CircuitPlayground hardware.
Definition: Adafruit_CircuitPlayground.cpp:39