filter flares on sensor pin

This commit is contained in:
2020-06-14 15:38:18 +02:00
parent 74110ff335
commit 0999882d2d
+6
View File
@@ -74,6 +74,12 @@ try:
logging.info('Wait for photo sensor')
GPIO.wait_for_edge(PIN_SENSOR, GPIO.RISING)
# filter short spikes on the sensor cable
time.sleep(0.2)
if (GPIO.input(PIN_SENSOR) == GPIO.LOW):
logging.info('Flare, continue')
continue
logging.info('Photo sensor active, activating light and camera')
play(SOUND_SCANNING)