Simple test¶
Ensure your device works with this simple test.
1# SPDX-FileCopyrightText: Copyright (c) 2021 Kattni Rembor for Adafruit Industries
2#
3# SPDX-License-Identifier: Unlicense
4# pylint: disable=no-member
5"""Display the microcontroller CPU temperature in C and F on a display."""
6import microcontroller
7from adafruit_simple_text_display import SimpleTextDisplay
8
9temperature_data = SimpleTextDisplay(title="Temperature Data!", title_scale=2)
10
11while True:
12 temperature_data[0].text = "Temperature: {:.2f} degrees C".format(
13 microcontroller.cpu.temperature
14 )
15 temperature_data[1].text = "Temperature: {:.2f} degrees F".format(
16 (microcontroller.cpu.temperature * (9 / 5) + 32)
17 )
18 temperature_data.show()