Add limit switch test code

This commit is contained in:
Tanner 2025-05-30 11:47:29 -07:00
parent 3443bd1f0b
commit 576f9ee94e

28
limits.py Normal file
View File

@ -0,0 +1,28 @@
import time
import sys
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(19, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(20, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(21, GPIO.IN, pull_up_down=GPIO.PUD_UP)
# 1 = optical path blocked, 0 = open
def test():
while True:
try:
print(
'GPIO19:', GPIO.input(19),
'GPIO20:', GPIO.input(20),
'GPIO21:', GPIO.input(21),
)
time.sleep(1)
except KeyboardInterrupt as e:
sys.exit()
if __name__ == '__main__':
test()