Software

MakeCode for CRICKIT // Circuit Playground Express

MakeCode is this programming editor that runs in the Google Chrome web browser. It’s has an intuitive interface that’s both block based and text editor.

It works with Adafruit's CRICKIT and Circuit Playground Express so you can make interactive projects with the on-board sensors and components. You can drag & drop blocks to make interactive programs using lights and sounds without having to solder or learning a new syntax.

You can upload code directly to the Circuit Playground Express with WebUSB is you use the information in the MakeCode tutorial WebUSB page.

Setup Circuit Playground Express for MakeCode

To get started, we'll need to head over to the Adafruit MakeCode website and follow the steps below.

  1. Plug in your Circuit Playground Express with a USB Cable
  2. Press the RESET button. Green light means you're ready to MakeCode
  3. Download the UF2 file and drop it onto CPLAYBOOT.

Install CRICKIT Extension for MakeCode

 

On the makecode site, click on New Project. In the list of blocks, select ADVANCED and then EXTENSIONS. Click on the Crickit block that shows up and install Crickit support! You will now have a new CRICKIT bin of blocks you can use! Continue on to learn how to use these blocks. Read the full guide here for more info.

Upload and Test Code

Once you have your CPX setup with the MakeCode UF2, try testing it out by uploading the code to the board. Click the link below to open up the program in makecode. Click on the pink edit icon near the top of the title to open the code. This will create a project in MakeCode and allow you to edit, modify and upload the code to the board. 

Motor Speed Controller MakeCode Program

 

The program uses motor blocks to control the speed of a motor. When the A or B buttons on the Circuit Playground are pressed, the motor speed changes. Each button press incrementally changes the speed of the motor. In the program, a motorSpeed variable is used to reference a value and changes on an action. The values are positive and negative numbers that are used to set the speed of the motor or brightness of the NeoPixels. 

Using Variables

 

We're used two variables, brightness and motorSpeed. The titles are self explanatory in which they'll be used. To create a variable, used the "Make a Variable" button under the Variable menu. Each variable block features a set and change block that can be used to adjust values.

Forever CodeBlock

 

In the forever code block, we have a crickit run motor and set brightness code block. These contain variables, indicated by the pink color blocks. Each is associated to their own type, motorSpeed for crickit run motor and set brightness for NeoPixels.

On Start CodeBlock

 

Use the set variable code blocks to set the brightness and motorSpeed on start. We can have it start fast or slow, depending on how we'd like the behavior to preform when we boot up the CRICKIT board. We can also set the color of NeoPixel.

On Change Variables

 

Use the on blocks to setup which buttons to activate the motor speed and neopixel brightness. Button A and B are used in this project. The change variable code block will set a given value whenever button A or B are pressed. The negative values are used to reduce the speed and brightness. Max value for brightness is 255. Max value for motor is 100.

 

This guide was first published on Aug 08, 2018. It was last updated on Aug 08, 2018. This page (Software) was last updated on Jul 19, 2019.