From 61201da8c6a1990c251ec2cb2efadfae55679c0d Mon Sep 17 00:00:00 2001 From: petrucci4prez Date: Sun, 18 Jun 2017 15:31:02 -0400 Subject: [PATCH] doc for sensors --- sensors.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sensors.py b/sensors.py index 1fdbd9d..6d83f5d 100644 --- a/sensors.py +++ b/sensors.py @@ -1,3 +1,6 @@ +''' +IR and magnetic sensors +''' import RPi.GPIO as GPIO import logging, time from functools import partial @@ -14,6 +17,15 @@ logger.setLevel(logging.INFO) INIT_DELAY = 60 def _lowPassFilter(pin, targetVal, period=0.001): + ''' + Crude implementation of an LPF for a binary signal. This exists to filter + out voltage spikes that are induced by mains current fuctuations. + + Basically uses a timed loop to determine if a pin is changing within a + given period. If a change occurs within period, this is considered 'high + frequency' and the function returns False. If not, the pin is evaluated with + a target value, which returns a boolean result that can be used elsewhere + ''' divisions = 10 sleepTime = period/divisions