MakeCode

Getting Familiar

This project runs a simple Microsoft MakeCode sketch to control the helmet, and is easy to play with if you want to make changes.

Microsoft MakeCode for Adafruit is a web-based code editor that provides a block editor, similar to Scratch or Code.org, and also a JavaScript editor for more advanced users.

If you've never used the Circuit Playground Express with MakeCode before, this guide is a good place to start.

How to Upload Code

To upload code to Circuit Playground Express, follow these instructions:

1) Connect your Circuit Playground Express to your computer using a micro USB cable and press the small reset button in the center of the board. All the LEDs will flash red briefly, then turn green. Your computer should now show a removable drive called CPLAYBOOT. 

2) Click the Download button in the code window below to download the .UF2 file to your computer.

3) Now drag and drop the .UF2 file onto the CPLAYBOOT drive in your computer's file explorer or finder.

Once the file is dragged onto CPLAYBOOT 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!

Note: If you get a drive named CIRCUITPY, no worries! Press the reset button twice to get a flash drive named CPLAYBOOT. The project will not run if copied onto the CIRCUITPY drive as it is for CircuitPython.

The Code

The code is shown below. For browser viewing, you may need to enable content. For example, in Chrome, click "Show Embedded Content" as the material is fed not from Adafruit but from Microsoft's MakeCode site.

To download the code, click the download link at the bottom of the window. To edit the code in MakeCode, click the box with arrow icon in the upper right corner of the window.

Adjusting Sensitivity

Getting your mask to react to the sound of your voice may take some trial and error. Sound levels in MakeCode are measured on a scale of 0-255. You can adjust the value at which the mask will start chomping by increasing the value in the while sound level ≥ 140 field to 150 (less sensitive) or down to 130 (more sensitive). 

This guide was first published on Jul 22, 2019. It was last updated on Jul 22, 2019. This page (MakeCode) was last updated on Sep 22, 2019.