Simple test

Ensure your device works with this simple test.

examples/as5600_simpletest.py
 1# SPDX-FileCopyrightText: Copyright (c) 2025 Noel Anderson
 2#
 3# SPDX-License-Identifier: Unlicense
 4
 5import time
 6
 7import board
 8import busio
 9
10from as5600 import AS5600
11
12i2c = busio.I2C(board.SCL, board.SDA)
13sensor = AS5600(i2c)
14
15# is the magnet detected?
16print(f"Magnet Detected: {sensor.is_magnet_detected}")
17
18# Set the hysteresis to 3 LSB to reduce the chance of flickering when magnet is still
19sensor.hysteresis = AS5600.HYSTERESIS_3LSB
20
21while True:
22    print(f"Angle: {sensor.angle}")
23    time.sleep(1)