Adafruit Library
|
Class that stores state and functions for interacting with CircuitPlayground hardware. More...
#include <Adafruit_Circuit_Playground.h>
Public Member Functions | |
bool | begin (uint8_t brightness=20) |
Set up the CircuitPlayground hardware. More... | |
bool | slideSwitch (void) |
read the slide switch More... | |
void | redLED (bool v) |
turn on or off the red LED on pin #13 More... | |
void | playTone (uint16_t freq, uint16_t time, bool wait=true) |
play a tone on the onboard buzzer More... | |
bool | leftButton (void) |
read the left button More... | |
bool | rightButton (void) |
read the right button More... | |
uint16_t | lightSensor (void) |
read the onboard lightsensor More... | |
int16_t | soundSensor (void) |
read the onboard sound sensor. A reading of ~0 is silent, and loud audio will result in a reading between -500 and 500 or so. More... | |
float | temperature (void) |
read the onboard thermistor. More... | |
float | temperatureF (void) |
read the onboard thermistor. More... | |
uint16_t | readCap (uint8_t p, uint8_t samples=10) |
read capacitive touch sensor More... | |
float | motionX (void) |
read the X parameter of the onboard accelerometer. Value returned is defined by setAccelRange(). More... | |
float | motionY (void) |
read the Y parameter of the onboard accelerometer. Value returned is defined by setAccelRange(). More... | |
float | motionZ (void) |
read the Z parameter of the onboard accelerometer. Value returned is defined by setAccelRange(). More... | |
void | setAccelRange (lis3dh_range_t range) |
set the range of the MEMS accelerometer. More... | |
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). More... | |
uint8_t | getAccelTap (void) |
test whether or not a tap has been detected More... | |
void | clearPixels (void) |
turn off all neopixels on the board | |
void | setPixelColor (uint8_t p, uint32_t c) |
set the color of a neopixel on the board More... | |
void | setPixelColor (uint8_t p, uint8_t r, uint8_t g, uint8_t b) |
set the color of a neopixel on the board More... | |
void | setBrightness (uint16_t b) |
set the global brightness of all neopixels. More... | |
uint8_t | sine8 (uint8_t x) |
Get a sinusoidal value from a sine table. More... | |
uint8_t | gamma8 (uint8_t x) |
Get a gamma-corrected value from a gamma table. More... | |
uint32_t | colorWheel (uint8_t x) |
get a color value from the color wheel. More... | |
void | senseColor (uint8_t &red, uint8_t &green, uint8_t &blue) |
detect a color value from the light sensor More... | |
uint32_t | senseColor () |
detect a color using the onboard light sensor More... | |
bool | isExpress (void) |
check whether or not this device is a CircuitPlayground Express. More... | |
Public Attributes | |
Adafruit_CPlay_NeoPixel | strip |
the neopixel strip object | |
Adafruit_CPlay_LIS3DH | lis |
the accelerometer object | |
Adafruit_CPlay_Mic | mic |
the microphone object | |
Adafruit_CPlay_Speaker | speaker |
the speaker object | |
Adafruit_CPlay_FreeTouch | cap [7] |
the array of capacitive touch sensors | |
IRrecvPCI | irReceiver |
the IR receiver object | |
IRdecode | irDecoder |
the IR decoder object | |
IRsend | irSend |
the IR send object | |
Class that stores state and functions for interacting with CircuitPlayground hardware.
bool Adafruit_CircuitPlayground::begin | ( | uint8_t | brightness = 20 | ) |
Set up the CircuitPlayground hardware.
brightness | Optional brightness to set the neopixels to |
bool Adafruit_CircuitPlayground::slideSwitch | ( | void | ) |
read the slide switch
void Adafruit_CircuitPlayground::redLED | ( | bool | v | ) |
turn on or off the red LED on pin #13
v | pass true to turn LED on, false to turn LED off |
void Adafruit_CircuitPlayground::playTone | ( | uint16_t | freq, |
uint16_t | time, | ||
bool | wait = true |
||
) |
play a tone on the onboard buzzer
freq | the frequency to play |
time | the duration of the tone in milliseconds |
wait | Optional flag to wait for time milliseconds after playing the tone. Defaults to true. |
bool Adafruit_CircuitPlayground::leftButton | ( | void | ) |
read the left button
bool Adafruit_CircuitPlayground::rightButton | ( | void | ) |
read the right button
uint16_t Adafruit_CircuitPlayground::lightSensor | ( | void | ) |
read the onboard lightsensor
int16_t Adafruit_CircuitPlayground::soundSensor | ( | void | ) |
read the onboard sound sensor. A reading of ~0 is silent, and loud audio will result in a reading between -500 and 500 or so.
float Adafruit_CircuitPlayground::temperature | ( | void | ) |
read the onboard thermistor.
float Adafruit_CircuitPlayground::temperatureF | ( | void | ) |
read the onboard thermistor.
uint16_t Adafruit_CircuitPlayground::readCap | ( | uint8_t | p, |
uint8_t | samples = 10 |
||
) |
read capacitive touch sensor
p | the pin to read. Must be a captouch enabled pin. |
samples | Optional number of samples to take. Defaults to 10. |
float Adafruit_CircuitPlayground::motionX | ( | void | ) |
read the X parameter of the onboard accelerometer. Value returned is defined by setAccelRange().
float Adafruit_CircuitPlayground::motionY | ( | void | ) |
read the Y parameter of the onboard accelerometer. Value returned is defined by setAccelRange().
float Adafruit_CircuitPlayground::motionZ | ( | void | ) |
read the Z parameter of the onboard accelerometer. Value returned is defined by setAccelRange().
|
inline |
set the range of the MEMS accelerometer.
range | the range to set the accelerometer to. LIS3DH_RANGE_2_G is the smallest (+-2G) but will give the greatest precision, while LIS3DH_RANGE_8_G is the largest (+-8G) but with the lease precision. LIS3DH_RANGE_4_G is in the middle. |
|
inline |
turn on tap detection. Tap detection can detect single taps or 'double taps' (like a double-click).
c | If c is 1 you will only detect single taps, one at a time. If c is 2, you will be able to detect both single taps and double taps. |
clickthresh | the threshold over which to register a tap |
|
inline |
test whether or not a tap has been detected
|
inline |
set the color of a neopixel on the board
p | the pixel to set. Pixel 0 is above the pad labeled 'GND' right next to the USB connector, while pixel 9 is above the pad labeled '3.3V' on the other side of the USB connector. |
c | a 24bit color value to set the pixel to |
|
inline |
set the color of a neopixel on the board
p | the pixel to set. Pixel 0 is above the pad labeled 'GND' right next to the USB connector, while pixel 9 is above the pad labeled '3.3V' on the other side of the USB connector. |
r | a 0 to 255 value corresponding to the red component of the desired color. |
g | a 0 to 255 value corresponding to the green component of the desired color. |
b | a 0 to 255 value corresponding to the blue component of the desired color. |
|
inline |
set the global brightness of all neopixels.
b | a 0 to 255 value corresponding to the desired brightness. The default brightness of all neopixels is 30. |
|
inline |
Get a sinusoidal value from a sine table.
x | a 0 to 255 value corresponding to an index to the sine table |
|
inline |
Get a gamma-corrected value from a gamma table.
x | a 0 to 255 value corresponding to an index to the gamma table |
uint32_t Adafruit_CircuitPlayground::colorWheel | ( | uint8_t | WheelPos | ) |
get a color value from the color wheel.
WheelPos | a value 0 to 255 |
void Adafruit_CircuitPlayground::senseColor | ( | uint8_t & | red, |
uint8_t & | green, | ||
uint8_t & | blue | ||
) |
detect a color value from the light sensor
red | the pointer to where the red component should be stored. |
green | the pointer to where the green component should be stored. |
blue | the pointer to where the blue component should be stored. |
|
inline |
detect a color using the onboard light sensor
bool Adafruit_CircuitPlayground::isExpress | ( | void | ) |
check whether or not this device is a CircuitPlayground Express.