Simple test

Ensure your device works with this simple test.

examples/clue_simpletest.py
 1# SPDX-FileCopyrightText: 2019 Kattni Rembor, written for Adafruit Industries
 2#
 3# SPDX-License-Identifier: MIT
 4from adafruit_clue import clue
 5
 6clue.sea_level_pressure = 1020
 7
 8while True:
 9    print("Acceleration: {:.2f} {:.2f} {:.2f} m/s^2".format(*clue.acceleration))
10    print("Gyro: {:.2f} {:.2f} {:.2f} dps".format(*clue.gyro))
11    print("Magnetic: {:.3f} {:.3f} {:.3f} uTesla".format(*clue.magnetic))
12    print("Pressure: {:.3f} hPa".format(clue.pressure))
13    print("Altitude: {:.1f} m".format(clue.altitude))
14    print("Temperature: {:.1f} C".format(clue.temperature))
15    print("Humidity: {:.1f} %".format(clue.humidity))
16    print("Proximity: {}".format(clue.proximity))
17    print("Gesture: {}".format(clue.gesture))
18    print("Color: R: {} G: {} B: {} C: {}".format(*clue.color))
19    print("--------------------------------")
examples/clue_display_sensor_data.py
 1# SPDX-FileCopyrightText: 2019 Kattni Rembor, written for Adafruit Industries
 2#
 3# SPDX-License-Identifier: MIT
 4from adafruit_clue import clue
 5
 6clue.sea_level_pressure = 1020
 7
 8clue_data = clue.simple_text_display(title="CLUE Sensor Data!", title_scale=2)
 9
10while True:
11    clue_data[0].text = "Acceleration: {:.2f} {:.2f} {:.2f} m/s^2".format(
12        *clue.acceleration
13    )
14    clue_data[1].text = "Gyro: {:.2f} {:.2f} {:.2f} dps".format(*clue.gyro)
15    clue_data[2].text = "Magnetic: {:.3f} {:.3f} {:.3f} uTesla".format(*clue.magnetic)
16    clue_data[3].text = "Pressure: {:.3f} hPa".format(clue.pressure)
17    clue_data[4].text = "Altitude: {:.1f} m".format(clue.altitude)
18    clue_data[5].text = "Temperature: {:.1f} C".format(clue.temperature)
19    clue_data[6].text = "Humidity: {:.1f} %".format(clue.humidity)
20    clue_data[7].text = "Proximity: {}".format(clue.proximity)
21    clue_data[8].text = "Gesture: {}".format(clue.gesture)
22    clue_data[9].text = "Color: R: {} G: {} B: {} C: {}".format(*clue.color)
23    clue_data[10].text = "Button A: {}".format(clue.button_a)
24    clue_data[11].text = "Button B: {}".format(clue.button_b)
25    clue_data[12].text = "Touch 0: {}".format(clue.touch_0)
26    clue_data[13].text = "Touch 1: {}".format(clue.touch_1)
27    clue_data[14].text = "Touch 2: {}".format(clue.touch_2)
28    clue_data.show()