Code with MakeCode
Microsoft MakeCode for Adafruit is a web-based code editor for physical computing. It provides a block editor, similar to Scratch or Code.org, and also a JavaScript editor for more advanced users.
This means you can drag and drop functionality that triggers the Circuit Playground Express' onboard inputs without ever writing a single line of code.
Planning
First let's decide what we want the code to do, exactly.
My plan is to have the inflatables blow up fully when I first power them up. I timed this and they take around 10-15 seconds (if the fan is unblocked by fabric and everything goes well). In practice, they need about 20 seconds so I have time to get everything arranged.
Then, I want the inflatable fans to turn off for a moment, then turn back on for a moment -- keeping the inflatables as full as possible but letting them "sag" for a couple seconds with no air flow coming in. This will create the wiggling tentacle motion I'm looking for.
These outlets aren't individually controllable. The whole power supply switches state every time we set the pin to "low" or "high." For now, let's keep it simple and just have the outlets turn on and off every 2 seconds. It can be tweaked and dialed in a little later.
Open a web browser and head to Makecode.Adafruit.com. Select New Project to get to the editor window.
The colored tabs contain the different blocks of code we'll be using.
Find the green "on start" block inside the LOOPS tab and drag it into the workspace. Anything we put in this block will run when the Circuit Playground first boots up.
Find the red "digital write Pin A0 to high/low" blocks under ADVANCED > PINS. Drag it into the on "start loop" and the "forever" loop as shown. I connected to pin A1, so that's the pin we'll set high/low. Select it in the dropdown.
Find the green "pause" blocks under LOOPS. I want my inflatables to be on for 20 seconds at boot-up so they fully inflate, so I set the pause block in the "on start" loop to 20000 ms. Then when they start to wiggle, I want them to alternate 2 seconds on and 2 seconds off, so I set the "pause" blocks in the FOREVER loop to 2000 ms.
Plug the Circuit Playground into your computer and click the reset button. Your Circuit Playground's lights should all turn green and a drive will appear on your computer called CPLAYBOOT. Simply drag the code you create in the next step to this drive to program the Circuit Playground.
Give your project a name and save it, then click the pink DOWNLOAD button. A .uf2 file will be saved to your downolads folder.
Drag this file onto your CPLAYBOOT drive to program the Circuit Playground.
Test your code by plugging your Circuit Playground into the "always on" outlet using a USB cable, and then plugging a test device (a lightbulb or your phone charger work great) into the "normally on" and "normally off" outlets. The device plugged into "normally off" should come on for 20 seconds, then start switching on and off every two seconds.
You can easily add random timing to your project if you're really looking for that "organic" motion feel. Find "pick random" under the MATH tab and drag it into the "pause" block to set a random amount of time within a certain window.
Go easy with this idea though -- if it "randomly" chooses deflation times that are a lot longer than inflation times, your inflatable may gradually collapse.
Page last edited October 28, 2025
Text editor powered by tinymce.