nightshift

This commit is contained in:
tilman
2016-12-27 02:05:51 +01:00
parent 6455b109ee
commit 16dd53d1c6
7 changed files with 123 additions and 12 deletions
+6 -4
View File
@@ -22,8 +22,9 @@ BUTTON_PAUSE = 0.4
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s.%(msecs)d %(levelname)s - %(message)s')
logging.info('Initializing')
# photo sensor on PIN 17
GPIO.setmode(GPIO.BCM)
# photo sensor on PIN 17
GPIO.setup(17, GPIO.IN)
# IR LED on PIN 22
@@ -45,12 +46,12 @@ photo_sensor_still_active = False
try:
logging.info('Start moc server')
subprocess.call(["padsp", "mocp", "--server"])
subprocess.call(["mocp", "--server"])
subprocess.call(["mocp", "--clear"])
subprocess.call(["mocp", "-l", SOUND_OK])
while True:
time.sleep(0.01)
time.sleep(0.05)
if (GPIO.input(9) == False):
logging.debug('mocp --previous')
@@ -74,7 +75,7 @@ try:
logging.debug('Photo sensor active, activating light and camera')
subprocess.call(["mocp", "-l", SOUND_SCANNING])
# turn LED on
# turn LED onGPIO.wait_for_edge(23, GPIO.FALLING)
GPIO.output(27, GPIO.HIGH)
# scan QR code
@@ -166,6 +167,7 @@ try:
# the photo sensor is not blocked (anymore)
photo_sensor_still_active = False
# Exit when Ctrl-C is pressed
except KeyboardInterrupt:
logging.info('Close moc server')