diff --git a/rpi/hardware/sound/sound.py b/rpi/hardware/sound/sound.py index e377d46f..a376110f 100644 --- a/rpi/hardware/sound/sound.py +++ b/rpi/hardware/sound/sound.py @@ -40,14 +40,15 @@ class SoundReader: def _read(self): measure_iteration = 100 + level = 0 i = 0 while self._running: - level = 0 if GPIO.input(self._pin): level += 1 if i == measure_iteration: self._notify(f'{{"soundSensorValue": {level}}}') i = 0 + level = 0 i += 1 time.sleep(0.02)