Class MotionSensor

    • Constructor Detail

      • MotionSensor

        public MotionSensor​(int gpio)
                     throws RuntimeIOException

        Defaults 'threshold' to 1, eventAge t0 20ms and eventDetectPeriod to 10ms.

        If your PIR sensor has a short fall time and is particularly "jittery" you may wish to set this to a higher value (e.g. 5) to mitigate this.

        Parameters:
        gpio - The GPIO which the motion sensor is attached.
        Throws:
        RuntimeIOException - If an I/O error occurred.
      • MotionSensor

        public MotionSensor​(int gpio,
                            int threshold,
                            int eventAge,
                            int eventDetectPeriod)
                     throws RuntimeIOException
        Parameters:
        gpio - The GPIO to which the motion sensor is attached.
        threshold - The value above which the device will be considered "on".
        eventAge - The time in milliseconds to keep active events in the queue.
        eventDetectPeriod - How frequently to check for events.
        Throws:
        RuntimeIOException - If an I/O error occurred.
      • MotionSensor

        public MotionSensor​(int gpio,
                            GpioPullUpDown pud,
                            int threshold,
                            int eventAge,
                            int eventDetectPeriod)
                     throws RuntimeIOException
        Parameters:
        gpio - The GPIO to which the motion sensor is attached.
        pud - Pull up/down configuration
        threshold - The value above which the device will be considered "on".
        eventAge - The time in milliseconds to keep active events in the queue.
        eventDetectPeriod - How frequently to check for events.
        Throws:
        RuntimeIOException - If an I/O error occurred.