An Arduino sketch for a skirt that had RGB LEDs and can respond to motion or sound.
The hardware consists of
- A Flora wearable microcontroller.
- A Flora Accelerometer Sensor based on the LSM303
- A ADMP401 MEMS microphone breakout board
- 12 Flora Smart Neo Pixels
- A switch
Build instructions can be found at [http://www.gregington.com/2013/10/disco-skirt.html].
The sketch needs to have the following libraries installed in the Arduino IDE:
- Adafruit_Sensor - the Base Adafruit sensor library
- Adafruit_LSM303 - to read the accelerometer
- Adafruit_NeoPixel - to drive the LEDs
- PinChangeInt - An interrupt library
- FHT - a Fast Hartley Transform for responding to sound
The code is designed to make it easy to add and remove modes. Each mode is stored in a separate file.
To change modify the
modes array to add or remove the required mode. Each entry in the array mist
be a function pointer to a function that takes no arguments. The specified function will be executed
continually in an infinite loop.
As an interrupt is used to trigger mode changes, use for the
delay() function is discouraged. A
DELAY macro is available as a convenience that breaks larger delays into smaller ones, checking
for a mode change every 10ms. If a mode change has been detected, then control will be returned
to the main loop which will advance the mode.
This project has built upon the work of others:
- The original [http://learn.adafruit.com/sparkle-skirt](Sparkle Skirt), designed by Becky Stern of Adafruit.
- Kasper Kamperman's [http://www.kasperkamperman.com/blog/arduino/arduino-programming-hsb-to-rgb/](HSB to RGB conversion) function