Before moving forward, let's take a moment to look at the code for this project.
If you'd like to learn more about MakeCode, this guide is a good place to start.
To make your board work with MakeCode we need to put 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.
Click this link or the button below to enter the portal to interact with the code for this project.
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 that .UF2 file onto the CPLAYBOOT drive. in your computer's file explorer or finder.
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!
Once your code is uploaded, plug the alligator clip to pin wires into the servo connector such that you have three alligator clips with the wires going to the servo harness.
Connect your servo motor to your Circuit Playground Express using the alligator clips.
You should see your motor start rotating 180 degrees, with a pause, before rotating back again.
This simple sketch tells your animatronic hand to look for a cool, dark place to hide. It does this by telling the motor to run until two conditions are both met.
forever block there is a
while statement, instructing the Circuit Playground Express to run the servo unless:
temperaturegoes below the specified threshold (in this case, 20 degrees Celsius)
light levelgoes below the specified value (in this case,
You can test this code by turning off the lights and cooling down the thermistor on the board (I used a quick blast from a can of compressed air).
If you'd like to play with this code, click "Edit" and a new window will open in which you can create your own version.
Problem: My servo motor isn't responding!
Solution: Make sure that you have the servo's wires connected to the correct pads. The brown wire should go to GND, the yellow wire to A1, and the red wire to VOUT.
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.