43 HCSR501(
unsigned int inputPinNumber);
69 virtual void TurnOn()
override;
81 virtual void TurnOff()
override;
108 virtual std::string
ToString()
const override;
Abstract base class for every component (sensor, actuator, etc.) the library manages.
Definition: BaseComponent.h:60
An HC-SR501 PIR motion sensor.
Definition: HCSR501.h:15
bool ConsumeMotionSinceLastRead()
Returns whether motion was seen since the last call, then clears the latch so the next window starts ...
Definition: HCSR501.cpp:166
unsigned int myInputPinNumber
The GPIO input pin the sensor is read from.
Definition: HCSR501.h:21
virtual void ProcessRawValues() override
Reads the sensor's pin (HIGH = motion) and latches any detection so a brief pulse between snapshots i...
Definition: HCSR501.cpp:89
HCSR501(unsigned int inputPinNumber)
Builds an HC-SR501 motion sensor on the given input pin, with no motion detected yet.
Definition: HCSR501.cpp:18
bool GetIsMotionDetected() const
Gets whether motion was detected on the most recent read.
Definition: HCSR501.cpp:148
virtual ~HCSR501()
Destroys the motion sensor.
Definition: HCSR501.cpp:38
virtual void TurnOn() override
Turns the sensor on: sets its pin as a digital input and enables the pull-down resistor so the line i...
Definition: HCSR501.cpp:54
virtual std::string ToString() const override
Serializes the sensor's current motion state to a string.
Definition: HCSR501.cpp:117
virtual void TurnOff() override
Turns the sensor off.
Definition: HCSR501.cpp:73
bool myMotionLatch
Latched "motion since the last read": ProcessRawValues raises it whenever the pin reads HIGH,...
Definition: HCSR501.h:27
bool myIsMotionDetected
Whether motion was detected on the most recent read.
Definition: HCSR501.h:18
RumPi is the library's top-level facade.
Definition: AlertManager.h:6