mupplet-core DigitalOut class
More...
#include <mup_digital_out.h>
|
| DigitalOut (String name, uint8_t port, bool activeLogic=false, const char *topic="relay") |
|
void | begin (Scheduler *_pSched) |
|
void | set (bool state) |
|
mupplet-core DigitalOut class
The DigitalOut class allows to integrate external relays or similar hardware that can be switched on or off.
Messages
Messages sent by the switch mupplet:
topic | message body | comment |
<mupplet-name>/<topic>/state | on , off | switch state, on or off . |
Message received by the switch mupplet:
topic | message body | comment |
<mupplet-name>/<topic>/set | on , off | Switches the GPIO output accordingly. |
Sample digital out Integration
#define __ESP__ 1
#include "scheduler.h"
#include "mup_digital_out.h"
ustd::Scheduler sched;
ust::DigitalOut relay("myRelay",13);
void setup() {
relay.begin(&sched);
}
More information: Digital out application notes
◆ DigitalOut()
ustd::DigitalOut::DigitalOut |
( |
String |
name, |
|
|
uint8_t |
port, |
|
|
bool |
activeLogic = false , |
|
|
const char * |
topic = "relay" |
|
) |
| |
|
inline |
Instantiate a DigitalOut object
- Parameters
-
name | Unique name of this mupplet, appears in pub/sub messages |
port | GPIO port number |
activeLogic | true: calling set with true generate HIGH level (active high), false: calling set with true generates LOW level (active low) |
topic | Topic name of the device, default value is "relay" |
◆ begin()
void ustd::DigitalOut::begin |
( |
Scheduler * |
_pSched | ) |
|
|
inline |
Initialize GPIO and start operation
- Parameters
-
_pSched | Pointer to Scheduler object, used for internal task and pub/sub. |
◆ set()
void ustd::DigitalOut::set |
( |
bool |
state | ) |
|
|
inline |
set assciated GPIO according to activeLogic defined in begin
- Parameters
-
state | logical state (is inverse to actual GPIO level, if activeLogic=false) |
The documentation for this class was generated from the following file: