If you are new to using Microsoft MakeCode, check out our guide to getting started.

We'll need to have the Crickit extension loaded to have the Circuit Playground Express and Crickit to work together. See this guide for the instructions.

The MakeCode program below is very similar to the CircuitPython program on the previous page.

You will need to use the VARIABLE block group to make four variables names raw_temp, temp_C, temp_F and heat_percent. raw_tempholds the raw analog reading of the TMP36 sensor with three MATH block operations: a multiply, a divide, and a subtraction. temp_C is the final calculated value of the temperature sensor in degrees Celsius. temp_F is the sensor temperature in Fahrenheit. heat_percent is the value read by the potentiometer expressed as a percentage from 0 to 100% and is used to drive the motor terminal 2 containing the heating pad. 

Variable show is used to signal the user has pushed the Circuit Playground Express A button toggling  between the NeoPixels reading the potentiometer from 0 to 100% and reading the temperature sensor from 80 degrees to 120 degrees Fahrenheit.

If you run the program with the MakeCode app in Windows 10, the console output will print off and graph the temperature and heating percent.


Note that heating elements take time to either heat up or cool down. When you adjust the potentiometer, you may not detect any immediate result until it registers a temperature change.

The NeoPixels will show the percentage of the Crickit applying voltage to the heating pad. No lights = 0%, 10 lights = 100%. To try it out, turn the potentiometer all the way counter-clockwise. Let the pad cool and note the temperature - it should be room temperature. Now turn the knob clockwise, wait and record the highest temperature. Do the same all the way to 100% so you have 11 values.

You can plot this yourself or record the data in a quick spreadsheet:

The data should be more of a line but measurements may be affected by where on the heating pad you measure and other conditions. I found it was best to measure in the middle of the pad if you can.

This guide was first published on Sep 11, 2018. It was last updated on Sep 11, 2018.

This page (MakeCode) was last updated on Apr 13, 2021.

Text editor powered by tinymce.