Friday 11 December 2020

Cube and microbit reacting to music


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)

 


Figure 1.




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:









All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

No comments:

Post a Comment

Top posts on this blog in March 2024

The Top 10 viewed post on this blog in March 2024. Covering areas such as small robots, augmented reality, Scratch programming, robots. Micr...