SimpleRelay
Loading...
Searching...
No Matches
SimpleRelay.h
Go to the documentation of this file.
1
25#pragma once
26
27#include <Arduino.h>
28
30public:
31 SimpleRelay(uint8_t pin, bool isInverted = false);
32
34
35 void on(void);
36
37 void off(void);
38
39 void toggle(void);
40
41 bool isRelayOn(void);
42
43private:
44 uint8_t m_pin;
53 byte m_relayOnLogicLevel;
54
58 enum class State {
59 RELAY_OFF,
60 RELAY_ON
61 };
62
68 State m_state = State::RELAY_OFF;
69};
~SimpleRelay()
Destructor for the class.
bool isRelayOn(void)
Get information if a relay is currently ON.
void off(void)
Set relay to OFF state.
void on(void)
Set relay to ON state.
void toggle(void)
Toggle relay state.