Code with MakeCode

Head over to makecode.adafruit.com to start coding! Choose the Circuit Playground Express option and create a new project.

We want the lights to come on when we move or shake, so we'll use the on shake input.  You can find this under the INPUT menu.  Drag it into your code workspace.

Next, we'll tell it what to do when we shake.  Under the LIGHT menu, choose the show animation block and drag that onto the workspace.  Put it inside the on shake block.

We want the sparkle animation for this project, so choose that one.  Then set the length you'd like the sparkles to last.  I chose 2 seconds.

Finally, let's tell the Circuit Playground to be sure all the lights go off at the end of our specified animation time.  Under LIGHT, drag out set all pixels to and then choose black, for off.  Put this in the on shake block after the animation.

You can play with the simulator on the left to see what happens!  Once you're happy with the code, click Download. Plug your Circuit Playground into your computer using a USB cable, tap the reset button on the Circuit Playground, and then drag the resulting file onto the CPLAYBOOT flash drive that appears in your file explorer/finder.  

Shake your Circuit Playground and watch the sparkle!

If you're having trouble, head over to the Circuit Playground Express guide here for some troubleshooting tips.

This guide was first published on Oct 18, 2018. It was last updated on Oct 18, 2018. This page (Code with MakeCode) was last updated on Oct 17, 2018.