Back to: Multiplier Event Luxembourg
The simple Python editor Mu, which works with the Circuit Playground Express, can create a serial connection to the Circuit Playground Express board. This allows us to display written values in the serial console and even plot them in the plotter.
Depending on the slide switch, the data is written to the serial console (left) or to the CircuitPython storage on the board. A stored file can be imported into a spreadsheet afterwards.

The following code allows us to write the room temperature, more precisely, the temperature measured near the temperature sensor. Placing the finger on it allows us to observe minimal temperature variations. A hairdryer or an ice pack can achieve a more considerable variation.
import time from adafruit_circuitplayground import cp # Loop forever while True: # Depending on the switch, write to # * the serial console (if True, i.e. left), or to # * the CircuitPython storage (if False, i.e. right). if cp.switch: print("Temperature is", "{:.2f}".format(cp.temperature), "°C =", "{:.2f}".format(cp.temperature * 1.8 + 32), "°F") print( (cp.temperature, cp.temperature * 1.8 + 32) ) else: f = open("temperature.csv", "a") f.write(repr(cp.temperature) + "," + repr(cp.temperature * 1.8 + 32) + "\n") f.close() # Sleep 1 second to slow down the readings. time.sleep(1)
import storage from adafruit_circuitplayground import cp storage.remount("/", readonly=cp.switch)
The plotter in Mu visualises the temperature changes of the data received by the Circuit Playground Express board. It draws curves for degrees Celsius (in blue) and degrees Fahrenheit (in green).
