sound files
This commit is contained in:
@@ -0,0 +1,31 @@
|
|||||||
|
# piplayer2
|
||||||
|
# http://www.tilman.de/piplayer2
|
||||||
|
|
||||||
|
|
||||||
|
import RPi.GPIO as GPIO
|
||||||
|
import time
|
||||||
|
|
||||||
|
# photo sensor on PIN 17
|
||||||
|
GPIO.setmode(GPIO.BCM)
|
||||||
|
GPIO.setup(17, GPIO.IN)
|
||||||
|
|
||||||
|
# LED on PIN 27
|
||||||
|
GPIO.setup(27, GPIO.OUT)
|
||||||
|
GPIO.output(27, GPIO.LOW)
|
||||||
|
|
||||||
|
try:
|
||||||
|
print('Start sensor test')
|
||||||
|
|
||||||
|
while True:
|
||||||
|
time.sleep(0.25)
|
||||||
|
if (GPIO.input(17) == GPIO.LOW):
|
||||||
|
print('LOW')
|
||||||
|
GPIO.output(27, GPIO.LOW)
|
||||||
|
else:
|
||||||
|
print('HIGH')
|
||||||
|
GPIO.output(27, GPIO.HIGH)
|
||||||
|
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print('bye')
|
||||||
|
GPIO.cleanup()
|
||||||
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user