adafruit-qt-py/arduino-ide-setup. There you’ll
also find all the information you need if you want
to use CircuitPython instead of Arduino IDE.
FLASH IT AND FLAUNT IT
The skirt is a great eye-catcher and attracts lots
of attention and smiling faces. Figure
P
shows
a sequence of the bouncing ball effect, but the
video is so much better. Check it out at youtube.
com/watch?v=3_XDv31yBbY.
Figure
Q
shows the fire and meteor effects
that are also available at the Github repository.
You can see them in the video too.
There are many further optimizations and
modifications possible, and some are already in
development. Just for starters, you could:
Use the gyro for rotation-triggered effects
Use the double-tap detection engine of the
sensor to switch between effects
Use the built-in pedometer to sync the effects
with your steps
Add backside LEDs for 360-degree effects (only
for showcases, don’t sit on them!)
Extend the LED strips for long skirts
There’s a good discussion going at my
Hackaday.io project page (hackaday.io/
project/177255-neopixel-led-skirt), and all future
source code will be uploaded to the Github repo,
so it will be easy to share and contribute — your
ideas are highly welcome. Using an ESP32 and
syncing multiple skirts with WLED (github.com/
Aircoookie/WLED) also could be a lot of fun!
In the main loop(), line 57 updates the sensor
data and the array diff[] is calculated as the
absolute difference between the last acceleration
sample and new sample for all three axes (Figure
O
). We’re only interested in the acceleration
change and don’t care about the static offset
value based on the gravitational acceleration.
Using all three axes also makes the calculation
independent from the orientation of the QT Py
board in the skirt pocket, so we don’t have to
worry about that. Line 68 updates the effect
continuously. If the effect with the shortest delay
has finished, line 70 checks for a new trigger
based on the sum of the axiss differences and
the previous defined motion threshold. If the
threshold was hit, the effects are restarted on all
bouncing balls. The code shown here changes
the color continuously during the effect; if you
prefer fixed colors, you can uncomment lines 72
and 78. This changes the color only for every new
bouncing effect cycle.
Of course, this is a simple example of motion
triggering because its using all the axes; you can
trigger the effect by jumping, spinning, starting to
run, whatever. If you prefer a single-axis trigger,
you can fix the orientation of the sensor in the
skirt pocket (or you can determine the orientation
by software using the g-offset and doing some
coordinate transformation to find the true z-axis).
8. UPLOAD THE CODE
To flash the code to the QT Py microcontroller,
just follow Adafruits guide at learn.adafruit.com/
59
makezine.com
Q
M77_052-59_LEDskirt_F1.indd 59M77_052-59_LEDskirt_F1.indd 59 4/11/21 1:56 PM4/11/21 1:56 PM
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.34.0