1
0
mirror of https://github.com/xtacocorex/CHIP_IO synced 2025-07-20 12:53:22 +00:00

Made test program a bit more user friendly.

This commit is contained in:
fordsfords
2016-07-02 19:21:28 -05:00
parent 71b6829804
commit 3c4040d32f

View File

@ -30,17 +30,24 @@ def loopfunction():
print "SLEEPING" print "SLEEPING"
time.sleep(1) time.sleep(1)
num_errs = 0
GPIO.selftest(0) GPIO.selftest(0)
GPIO.setup("XIO-P0", GPIO.IN) GPIO.setup("XIO-P0", GPIO.IN)
GPIO.setup("CSID0", GPIO.OUT, initial=GPIO.HIGH) GPIO.setup("CSID0", GPIO.OUT, initial=GPIO.HIGH)
assert(GPIO.input("XIO-P0") == GPIO.HIGH) if (GPIO.input("XIO-P0") != GPIO.HIGH):
print "A high output on CSI0 does not lead to a high input on XIO-P0."
print "Perhaps you forgot to connect them?"
num_errs += 1
GPIO.cleanup() GPIO.cleanup()
GPIO.setup("XIO-P0", GPIO.IN) GPIO.setup("XIO-P0", GPIO.IN)
GPIO.setup("CSID0", GPIO.OUT, initial=GPIO.LOW) GPIO.setup("CSID0", GPIO.OUT, initial=GPIO.LOW)
assert(GPIO.input("XIO-P0") == GPIO.LOW) if (GPIO.input("XIO-P0") != GPIO.LOW):
print "A low output on CSI0 does not lead to a low input on XIO-P0."
print "Perhaps you forgot to connect them?"
num_errs += 1
GPIO.cleanup() GPIO.cleanup()
GPIO.setup("XIO-P0", GPIO.IN) GPIO.setup("XIO-P0", GPIO.IN)
@ -137,3 +144,5 @@ except:
print "CLEANUP" print "CLEANUP"
GPIO.cleanup() GPIO.cleanup()
print "done,", num_errs, " errors"