RumPi 1.0
A self-assembling C++ sensor & actuator library for the Raspberry Pi 5
Relay.h
Go to the documentation of this file.
1#pragma once
2#include <stdio.h>
3#include <wiringPi.h>
4#include "BaseComponent.h"
5
6namespace RumPi
7{
14 class Relay : public BaseComponent
15 {
16 private:
18 unsigned int myPinNumber;
19
20 public:
34 Relay(unsigned int pinNumber);
35
47 virtual ~Relay();
48
59 virtual void TurnOn() override;
60
71 virtual void TurnOff() override;
72
84 virtual void ProcessRawValues() override;
85
98 virtual std::string ToString() const override;
99
112 unsigned int GetPinNumber() const;
113
114 };
115} // namespace RumPi
Abstract base class for every component (sensor, actuator, etc.) the library manages.
Definition: BaseComponent.h:60
A relay driven by a single GPIO pin (output-only, like an LED).
Definition: Relay.h:15
virtual void ProcessRawValues() override
Processes the relay's raw values.
Definition: Relay.cpp:83
virtual std::string ToString() const override
Serializes the relay's state (its pin number) to a string.
Definition: Relay.cpp:99
unsigned int GetPinNumber() const
Gets the GPIO pin the relay is driven on.
Definition: Relay.cpp:121
Relay(unsigned int pinNumber)
Builds a relay on the given GPIO pin and sets that pin to output mode.
Definition: Relay.cpp:18
virtual void TurnOff() override
Turns the relay off (drives its pin low).
Definition: Relay.cpp:67
virtual void TurnOn() override
Turns the relay on (drives its pin high).
Definition: Relay.cpp:52
virtual ~Relay()
Destroys the relay.
Definition: Relay.cpp:37
unsigned int myPinNumber
The GPIO pin the relay is driven on.
Definition: Relay.h:18
RumPi is the library's top-level facade.
Definition: AlertManager.h:6