Simple test¶
Ensure your device works with this simple test.
1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2# SPDX-License-Identifier: MIT
3
4import time
5import board
6import adafruit_tlv493d
7
8i2c = board.I2C() # uses board.SCL and board.SDA
9# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
10tlv = adafruit_tlv493d.TLV493D(i2c)
11
12while True:
13 print("X: %s, Y: %s, Z: %s uT" % tlv.magnetic)
14 time.sleep(1)