Notes:
Assembly:
Suggested use:
See it in action here:
Code for Hall effect sensor hooked up to raspberry pi pico:
I used CircuitPython. This isn't clean but just for reference if you wanna do something similar.
import board
import busio
import time
from digitalio import DigitalInOut, Direction, Pull
from analogio import AnalogIn
from adafruit_ht16k33.segments import Seg7x4
import TM1637
# Sensor
# mag = AnalogIn(board.GP26)
mag_dig = DigitalInOut(board.GP17)
mag_dig.pull = Pull.DOWN
mag_dig.direction = Direction.INPUT
# Display
CLK = board.GP1
DIO = board.GP0
display = TM1637.TM1637(CLK, DIO)
#button
btn = DigitalInOut(board.GP16)
btn.pull = Pull.DOWN
led = DigitalInOut(board.LED)
led.direction = Direction.OUTPUT
counter = 0
magValPrev = True
led.value = True
display.number(counter)
while True:
# print(f"Dig: {mag_dig.value}")
#print(f"Analog: {mag.value}")
if not mag_dig.value and magValPrev is True:
counter = counter + 1
display.number(counter)
if btn.value:
counter = 0
display.number(counter)
magValPrev = mag_dig.value
#print(f"btn value: {btn.value}")
time.sleep(0.02)
The author marked this model as their own original creation.