Simple test

Ensure your device works with this simple test.

examples/tmag5273_simpletest.py
 1# SPDX-FileCopyrightText: Copyright (c) 2026 Liz Clark for Adafruit Industries
 2#
 3# SPDX-License-Identifier: MIT
 4
 5import time
 6
 7import board
 8
 9import adafruit_tmag5273
10
11i2c = board.I2C()
12sensor = adafruit_tmag5273.TMAG5273(i2c)
13
14while True:
15    mag_x, mag_y, mag_z = sensor.magnetic
16    temp = sensor.temperature
17    print(f"X: {mag_x:.2f} uT  Y: {mag_y:.2f} uT  Z: {mag_z:.2f} uT  Temp: {temp:.1f} °C")
18    time.sleep(1)