Programming with MakeCode

For this project, I’m using the accelerometer, speaker and ring of NeoPixels on the Circuit Playground Express. I have the code running so that when you shake the Circuit Playground, the NeoPixels animate in the rainbow effect and it plays some music.

It’s fairly easy to program music into a project with MakeCode. You use the note blocks to select your note and how many beats you want the note to play for. There’s even a small piano keyboard that opens up with it if you want to write your own music on the fly. To have the NeoPixels change with the music, I have the animation advancing by one frame after each note is played. The music and NeoPixel code blocks are nested in a function box called “playMusic” so that I can put a function block inside of the “On Shake” block. This tells the Circuit Playground to play the music and light up the lights every time its shaken.

This guide was first published on Dec 13, 2017. It was last updated on Dec 13, 2017. This page (Programming with MakeCode) was last updated on Oct 19, 2019.