Qudio documentation

This commit is contained in:
2019-01-22 15:44:44 +01:00
parent 47cf97d488
commit df671e49f9
5 changed files with 43 additions and 26 deletions
+10 -10
View File
@@ -1,27 +1,27 @@
import RPi.GPIO as GPIO
import time
# photo sensor on PIN 17
# photo sensor on PIN 5
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN)
GPIO.setup(5, GPIO.IN)
# LED on PIN 27
GPIO.setup(27, GPIO.OUT)
GPIO.output(27, GPIO.LOW)
# LED on PIN 22
GPIO.setup(22, GPIO.OUT)
GPIO.output(22, GPIO.LOW)
try:
print('Start sensor test')
while True:
time.sleep(0.75)
if (GPIO.input(17) == GPIO.LOW):
time.sleep(0.5)
if (GPIO.input(5) == GPIO.LOW):
print('LOW')
GPIO.output(27, GPIO.LOW)
GPIO.output(22, GPIO.LOW)
else:
print('HIGH')
GPIO.output(27, GPIO.HIGH)
GPIO.output(22, GPIO.HIGH)
except KeyboardInterrupt:
print('KeyboardInterrupt')
GPIO.cleanup()
GPIO.cleanup()