Now it's time to upload some code! For this we will be using Microsoft MakeCode for Adafruit, a web-based code editor. It provides a block editor, similar to Scratch or Code.org, and also a JavaScript editor for more advanced users.

If you haven't used MakeCode before, this guide is a good place to start.

Getting into Bootloader Mode

Your Circuit Playground Express board comes ready to work with CircuitPython. When you connect the board to your computer for the first time, it will appear as a flash (or thumb) drive named CIRCUITPY.

BUT

We'd like to make it work with MakeCode, which is done by putting it into "bootloader mode". All that's required to do this is to connect the board to your computer with a micro USB cable and click the small reset button in the center of the board. 

The Code

Click the green button below to interact with the code used in this project.

How to upload code

To upload code, connect you Circuit Playground Express to your computer using the micro USB cable, click the Download button to download the .uf2 file to your computer, and drag 'n drop it onto the CPLAYBOOT drive. 

The drive will automatically eject itself. (Your computer may give you a "failed to eject drive correctly" error, you can ignore this.) The code is now on your Circuit Playground Express and ready to run!

Understanding the Code

This code template allows for control of both the spinning DC motors that launch the plane, and a servo motor (optional) that can be used as a trigger.

To turn on the spinning wheels, flip the mini slide switch to the Left. To turn those motors off, flip the switch to the right.

If either of your wheels are spinning in the wrong direction, you can change the crickit set motor 1 inverted and crickit set motor 2 inverted to ON or OFF to change the direction of spin.

If you'd like to change the direction the wheels spin without changing the code, unclip the alligator clips connecting the motors to Crickit and switch their positions.

Troubleshooting

Problem: My motors aren't spinning!

Solution: Make sure that the small slide switch on the CRICKIT is set to "ON".

 

Problem: My Circuit Playground Express doesn't show up as CPLAYBOOT!

Solution: Your Circuit Playground Express board comes ready to work with CircuitPython, and will show up as a flash drive named CIRCUITPY the first time it's connected to your computer. To switch over to work with MakeCode, connect the board to your computer with a micro USB cable and click the small reset button in the center of the board.  

When Circuit Playground Express is in Bootloader mode, all the LEDs will flash red briefly, then turn green. Your computer should now show removable drive called CPLAYBOOT. Now you can copy the MakeCode file to the CPLAYBOOT flash drive.

This guide was first published on Aug 27, 2018. It was last updated on Aug 27, 2018.

This page (Coding with MakeCode) was last updated on Aug 22, 2018.

Text editor powered by tinymce.