The Circuit Playground Express is an easy way to get started learning electronics and coding. It's filled with tons of fun lights and sensors! The CPX is what we'll use to control the mouse and keyboard to draw in our new Scratch program. Head here to learn more about the CPX.
MakeCode is a web-based code editor for physical computing made by Microsoft.
It is almost identical to Scratch in design, however it is mainly for programming hardware like the CPX rather than a sprite on a computer screen.
More on MakeCode for Adafruit boards here.
Head over to https://makecode.adafruit.com/ and create a new project.
Click the button below to access the code for this project.
Follow this guide on how to add these extensions to MakeCode. They will allow us to use the CPX to act as a mouse and a keyboard!
1 G (one gee) is equivalent to Earth's gravitational pull at a resting point.
The CPX's accelerometer senses the gravity it feels in any given direction on the x, y or z axis. The value it senses is anywhere from 0 to 1023 mg (miligravities). 1G = 1000 miligravities.
Learn more about the accelerometer on the Circuit Playground Express here.
Now that we have the code for the project, we need to upload it to the CPX.
Let's name our file and download it.
- Choose a name at the bottom of the page.
- Then click the pink Download button.
Follow the directions and connect your CPX to your computer via the USB cable. Click the CPX Reset button once to go into programming mode (all the Circuit Playground Expresses' LED light NeoPixels will turn green).
In some cases, you may need to press the reset button twice to get into programming mode.
Next, look for the file in your downloads folder and drag it onto your CPLAYBOOT drive that should have showed up in your file manager/finder when you plugged in your board and entered programming mode.
Once your code file is placed on the CPLAYBOOT drive should see the CPLAYBOOT drive disappear indicating the code is running.