MakeCode is Microsoft's drag-and-drop code editor. It makes it easy for beginners and/or kids to get up and running with the Circuit Playground Express. So many options are accessible and easy with MakeCode, and it's really fun to customize and play around with making blinky lights and sounds.
Here's the completed project. Click the Download link at the bottom, plug your Circuit Playground Express into your computer and drag the file onto the resulting CPLAYBOOT drive.
Or, follow along below to create your own project from scratch.
Code It Yourself
Head to https://www.makecode.com and choose the Circuit Playground Express. Select "New Project" and give it a name. I called mine "Steven Universe Gem."
Click the INPUT tab and find the
on shake block. Drag it out into your workspace and change the dropdown so it reads
on tilt left.
Click the LIGHT tab and look for the ring of lights. Drag this into your workspace and place it inside the
on tilt left block you just made. Select one of the colors from the inner ring, and click each of the lights to change it to that color. I'm using purple, for Amethyst.
Now, once you've downloaded the code, your lights will turn purple when you tilt the Circuit Playground to the left! Let's make them turn yellow, like Pearl's gem, when we tilt right.
Right-click on the pink
on tilt left block and choose "Duplicate." Another block will appear, identical to the first one. Change the dropdown to
tilt right and change all the colors to yellow.
Let's duplicate one more time. This time we'll set the dropdown to
on shake. Change the colors to a pretty assortment that reminds you of Opal's fusion gem.
Plug your Circuit Playground Express into your computer using a USB cable. You will see a rainbow animation appear the first time it boots up. Click the tiny Reset button in the middle of the board and the lights will all turn red, then green. When the lights turn green, a new drive will appear on your computer called CPLAYBOOT.
In MakeCode, click the Download button to download your code to a file. Drag this file onto the CPLAYBOOT drive. The Circuit Playground Express will reboot and eject itself.
Tilt left and right to see the colors change. Shake the Circuit Playground and watch the gems fuse!
You can go back and change the colors to anything you want! Try adding sounds too. Once you're happy with how it works, let's make the outside of the gem.
If you're having trouble, head over to the Circuit Playground Express tutorial for some troubleshooting ideas.