- supported capacitive touch sensing
- implemented WS2812 RGB LED driver
- built USB to Serial bridge and SPI bridge between Arduino (ATmega32U4) and linux based OpenWrt (MT7688)
- Arduino IDE 1.6.8+. Please use Arduino IDE 1.6.8+ which has some useful new features
- Download zip file and extract it into Arduino's libraries directory.
- Rename
respeaker_arduino_library-master
torespeaker
- Light - chasing colors
#include "respeaker.h"
uint8_t offset = 0;
void setup() {
respeaker.begin();
respeaker.pixels().set_brightness(128); // set brightness level (from 0 to 255)
}
void loop() {
respeaker.pixels().rainbow(offset++);
delay(10);
}
- Touch & Sound - touch to play
#include "respeaker.h"
// wav or mp3 files on SD card
const char *sound_map[] = {"a1.wav", "b1.wav", "c1.wav", "d1.wav", "e1.wav", "f1.wav", "g1.wav", "c2.wav"};
void setup() {
respeaker.begin();
respeaker.attach_touch_handler(touch_event); // add touch event handler
}
void loop() {}
// id: 0 ~ 7 - touch sensor id; event: 1 - touch, 0 - release
void touch_event(uint8_t id, uint8_t event) {
if (event) {
respeaker.play(sound_map[id]);
}
}
#include "respeaker.h"
#define IFTTT_MAKER_CHANNEL_KEY "" // add the key of your ifttt maker channel
#define EVENT "ping"
const char *ifttt_ping = "curl -X POST https://maker.ifttt.com/trigger/" EVENT "/with/key/" IFTTT_MAKER_CHANNEL_KEY;
void setup() {
respeaker.begin();
respeaker.attach_touch_handler(touch_event); // add touch event handler
}
void loop() {}
// id: 0 ~ 7 - touch sensor id; event: 1 - touch, 0 - release
void touch_event(uint8_t id, uint8_t event) {
if (event == 1 && id == 0) {
respeaker.exec(ifttt_ping);
}
}