In a previous post - 'Dancing' Snowman - ok flashing LEDs to music - I played with Microbit V2 with its built-in microphone in combination with a Ryan Walmsley's SnowPi RGB https://www.kickstarter.com/projects/ryanwalmsley/snowpi-rgb-edition to make a Snowman that reacts to music.
In this post, the aim is to show the idea been extended to a Cube of programmable LEDs the 4tronix's Cube:Bit. Essentially the process is the same as the previous post the microphone detects the sound level and cause an LED to light up.
Only a few minor changes were made to the code from the previous example.
- The Pin had to be changed from 2 to 0 in the code (see Figure 1);
- Increase the number of pixels/LEDs in the settings (see Figure 1);
- It no longer chooses random LEDs/pixels to light up; but alters the first one and shifts the result to the result to the next one - so the lights shifts through the LEDs (see figure 2);
- Add in when it is quiet set the first LED to set a value and shift along (see figure 2)
The code used is available at https://makecode.microbit.org/_3pT6zaRgy8T5 please feel to play and adapted and share your improvements.
The video below shows it in action:
Music used Good Vibe by Ketsa is licensed under an Attribution-NonCommercial-NoDerivatives 4.0 International License. available at https://freemusicarchive.org/music/Ketsa/ascendance/good-vibe
Code is available at https://makecode.microbit.org/_3pT6zaRgy8T5
No comments:
Post a Comment