Getting your code into your device is very easy with MakeCode. You do not need to install any software on your machine and the process takes two steps:
- Step 1: Connect your board via USB and enter bootloader mode
- Step 2: Compile and Download the .uf2 file into your board drive
We are going to go through these two steps in detail.
When the Circuit Playground Express is in Bootloader mode, all the LEDs will turn red briefly, then green. Verify your status LED is also pulsing red. Your computer should show a new removable drive called "CPLAYBOOT"
If the LEDs are all red: Either the computer is still installing drivers (Please wait a minute, Windows takes some time to install updates.) or you have a bad USB connection. If you keep getting red LEDs - try a new USB cable (you may want to ensure your USB cable is not charge only, it needs to transfer data) or a different USB port.
Once your LEDs are all green, you should see a CPLAYBOOT drive appear in your drive list in your file explorer.
We are now ready to compile our blinky code and download it to our board!
Let's first verify that our code compiles properly in MakeCode.
MakeCode has a built-in simulator that re-loads and re-runs code when restarted. This is an easy way to both ensure that our code compiles and simulate it before moving it onto the board. The refresh button re-loads the simulator with your latest version of block code.
If your board is working in the simulator, it's time to download it to your actual board! Click the "Download" button. It will generate a .uf2 file and download it to your computer (UF2 is a file format designed to flash microcontrollers over USB).
General Steps to copy over your program (not specific to any Operating system)
- Ensure your board is in bootloader mode.
- Find the .uf2 file generated by MakeCode in your file explorer. Copy it to the "CPLAYBOOT" volume.
- The status LED on the board will blink while the file is transferring. Once it's done transferring your file, the board will automatically reset and start running your code (just like in the simulator!)
Windows: Open Windows Explorer (Windows key + E key) and locate the "blinky.uf2" file you generated. It's probably in your Downloads folder!
You can copy/paste the file to your CPLAYBOOT volume or you can drag/drop it like in the GIF below.
macOS: Open Finder and locate the "blinky.uf2" file. You can copy/paste this file to the "cplayboot" volume or drag/drop it from the same finder window.
If you want to avoid the copying process: You can download your programs directly to the board. To do this: change the download location in Chrome, Firefox, Safari, or Opera to the main directory of your "CPLAYBOOT" volume.
If you unplug your board and then plug it back in again to your computer, it may not run the program again automatically. If it instead shows all green NeoPixels, just press the reset button and your program will start.