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