Simple test¶
Ensure your device works with this simple test.
1# SPDX-FileCopyrightText: 2020 by Bryan Siepert, written for Adafruit Industries
2#
3# SPDX-License-Identifier: Unlicense
4from time import sleep
5import board
6import busio
7from adafruit_mlx90395 import MLX90395
8
9
10i2c = busio.I2C(board.SCL, board.SDA)
11sensor = MLX90395(i2c)
12
13while True:
14 print("X:{0:5.2f}, Y:{1:5.2f}, Z:{2:5.2f} uT".format(*sensor.magnetic))
15 print("")
16
17 sleep(0.5)