2
Beginner
Project guide
CircuitPython
The ScoutMakes DRV5032 Hall Sensor can be easily used with CircuitPython. Since the signal pin from the breakout board drives HIGH or LOW based on the presence of a magnetic field, it can be easily connected to IO pins to a QT Py, for example, or other microcontroller.
"""CircuitPython ScoutMakes DRV5032 Digital Hall Sensor example"""
import time
import board
from digitalio import DigitalInOut, Direction, Pull
switch = DigitalInOut(board.A0)
switch.direction = Direction.INPUT
switch.pull = Pull.UP
while True:
# We could also do "led.value = not switch.value"!
if switch.value:
print ("1")
else:
print ("0")
time.sleep(0.1) # debounce delay
Page last edited September 23, 2024
Text editor powered by tinymce.