mirror of
https://gitlab.com/wirelos/sprocket-plugin-mqtt.git
synced 2025-12-14 13:51:27 +01:00
documentation
This commit is contained in:
@@ -11,11 +11,16 @@ Task publishHeap;
|
|||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
publishHeap.set(TASK_SECOND * 5, TASK_FOREVER, [](){
|
publishHeap.set(TASK_SECOND * 5, TASK_FOREVER, [](){
|
||||||
|
// publish locally to local/topic
|
||||||
|
// and remotely to wirelos/mqttSprocket-out/local/topic
|
||||||
sprocket->publish("local/topic", "heap=" + String(ESP.getFreeHeap()));
|
sprocket->publish("local/topic", "heap=" + String(ESP.getFreeHeap()));
|
||||||
});
|
});
|
||||||
|
|
||||||
sprocket = new Sprocket(
|
sprocket = new Sprocket(
|
||||||
{STARTUP_DELAY, SERIAL_BAUD_RATE});
|
{STARTUP_DELAY, SERIAL_BAUD_RATE});
|
||||||
|
|
||||||
|
// subscribe locally to local/topic
|
||||||
|
// and remotely to wirelos/mqttSprocket-in/local/topic
|
||||||
sprocket->subscribe("local/topic", [](String msg){
|
sprocket->subscribe("local/topic", [](String msg){
|
||||||
PRINT_MSG(Serial, "LOCAL", msg.c_str());
|
PRINT_MSG(Serial, "LOCAL", msg.c_str());
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user