Plotting with MakeCode

With the Windows 10 app MakeCode for Adafruit, you have the new availability to send serial data back to the MakeCode console, similar to the Mu Editor Serial/REPL capability.

When you want to see data (and to plot it), you use blocks in the CONSOLE block group, which is under the black ADVANCED block group.

The console log block will send any value to the console via the Circuit Playground Express USB connection. The console log value block does the same, and you can name the value, which is good if you are sending multiple types of information out.

Take a simple task to send light sensor values to the console. Without downloading this code, the interface will run using the simulator with the light level adjustable via a circle to the upper left of the simulated board.

The difference is shown when you actually download the code to the Circuit Playground Board. Using the Windows 10 app, the interface adds a Show console Simulator button below the Show console Device button.

Click the Show console Device button and you'll see the following:

In the device console, you'll see the values for the light sensor in a window towards the bottom and a plot vs. time to the right of the image of the Circuit Playground Express.

You can plot any kind of data in the device console. You can also display and plot multiple values. It is best if you use the console log value block and name your feeds. To plot the temperature and the light, value press the words Go back then change the code: 

Download the code to your Circuit Playground Express board and then click the Show console Device button again:

You can see the values being printed below and each reading plotted verses time. You can see the labels help identify the values.

If the readings are done too quickly, you can put a pause or wait block in to take values in a more timed fashion as shown below where the readings are taken once a second (= 1000 milliseconds)

Download to an Excel Spreadsheet

If you have Excel on your Windows 10 PC, you can click the button shown below (far right) above the plots (circled in red below):

MakeCode will open Excel and paste the data to a new spreadsheet!

This guide was first published on Jul 23, 2018. It was last updated on Jul 23, 2018. This page (Plotting with MakeCode) was last updated on Dec 05, 2019.