From 0999882d2d689f4b3192ab5514ef05485db768cf Mon Sep 17 00:00:00 2001 From: Tilman Date: Sun, 14 Jun 2020 15:38:18 +0200 Subject: [PATCH] filter flares on sensor pin --- code/audiorocket.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/code/audiorocket.py b/code/audiorocket.py index 701762f..b4ba325 100644 --- a/code/audiorocket.py +++ b/code/audiorocket.py @@ -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)