71 virtual void TurnOn()
override;
83 virtual void TurnOff()
override;
123 virtual std::string
ToString()
const override;
Abstract base class for every component (sensor, actuator, etc.) the library manages.
Definition: BaseComponent.h:60
Interface for analog-to-digital converter components (e.g.
Definition: AnalogDigitalConverterComponent.h:14
Photoresistor (LDR) - reads ambient light as an analog value through an ADC channel.
Definition: Photoresistor.h:15
virtual ~Photoresistor()
Destroys the sensor, turning it off first.
Definition: Photoresistor.cpp:55
Photoresistor()
Builds a default photoresistor with no ADC wired yet.
Definition: Photoresistor.cpp:15
unsigned int myAnalogToDigitalConverterPinIndex
The ADC channel index this sensor reads from.
Definition: Photoresistor.h:17
virtual std::string ToString() const override
Serializes the photoresistor's raw analog value to a string.
Definition: Photoresistor.cpp:139
IAnalogDigitalConverterComponent * myAnalogToDigitalConverter
The ADC this sensor reads through.
Definition: Photoresistor.h:18
virtual void ProcessRawValues() override
No-op: the photoresistor reads its value on demand in ReadRawAnalogValue, so there are no raw values ...
Definition: Photoresistor.cpp:100
virtual void TurnOff() override
No-op: the photoresistor holds no resources that need releasing when turned off.
Definition: Photoresistor.cpp:85
void SetAnalogDigitalConverter(IAnalogDigitalConverterComponent *analogDigitalConverter)
Sets the ADC this sensor reads through.
Definition: Photoresistor.cpp:212
IAnalogDigitalConverterComponent * GetAnalogDigitalConverter() const
Gets the ADC this sensor reads through.
Definition: Photoresistor.cpp:178
virtual void TurnOn() override
No-op: the photoresistor is passive and reads on demand, so there is nothing to turn on.
Definition: Photoresistor.cpp:70
void SetAnalogToDigitalConverterPinIndex(unsigned int pinIndex)
Sets the ADC channel index this sensor reads from.
Definition: Photoresistor.cpp:195
int ReadRawAnalogValue() const
Reads the raw analog light value from the ADC, or -1 if no ADC is wired.
Definition: Photoresistor.cpp:117
unsigned int GetAnalogToDigitalConverterPinIndex() const
Gets the ADC channel index this sensor reads from.
Definition: Photoresistor.cpp:161
RumPi is the library's top-level facade.
Definition: AlertManager.h:6