def __init__(self):
GPIO.setmode(GPIO.BCM)
#Setup each hall effect pin for interrupts
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(24, GPIO.IN, pull_up_down=GPIO.PUD_UP)
print ("Encoders Ready")
GPIO.add_event_detect(18, GPIO.FALLING, callback=self.add_right_pulse)
GPIO.add_event_detect(24, GPIO.FALLING, callback=self.add_left_pulse)
while 1:
pass
# Callback function for Hall Sensor interrupts
评论列表
文章目录