Lights synchronized to music, what’s not to love? YouTuber “Robert Robert” has done just that using 24 acrylic blocks, an Arduino Uno, four 12-pixel WS2812B addressable LED strips, an Adafruit electret microphone amplifier, a 12000mAh external battery pack, and some code.
The blocks are divided into two sets of 12, held together by threaded rods and nuts, with LED strips hot glued to the back. A 60cm x 40cm stainless steel shelf rests underneath to reflect the light back.
In terms of code, the project uses Adafruit’s NeoPixel library:
The first part of the code is Adafruit’s own mic code which calibrates the sound level so that whether you’re using a big speaker or, as in the video, a tiny iPad speaker, the mic remains sensitive. The second part of the code maps the sound level onto 12 if statements so that when quiet it idles with the NeoPixel library rainbow but then as the sound level gets higher more effects are triggered. Within each if statement I have then included a random() function so that the display stays interesting. You can edit each individual strip pixel to create patterns in an infinite variety of ways and using the random () function you can keep on building so you never get bored. The code works best with music with a wide dynamic range (soft and loud parts).
from Arduino Blog http://bit.ly/1ZyNuoj
0 commentaires:
Enregistrer un commentaire