MQTT Client example program. Ethernet connection is via an ENC28J60 module.
Dependencies: UIPEthernet MQTTClient
Diff: main.cpp
- Revision:
- 5:c0716c55b302
- Parent:
- 4:abcd50d71e61
- Child:
- 7:4435b52322e4
--- a/main.cpp Sat Nov 28 10:36:41 2015 +0000 +++ b/main.cpp Sat Nov 28 10:43:59 2015 +0000 @@ -39,7 +39,7 @@ const IPAddress MY_IP(192, 168, 1, 181); #endif -const int INTERVAL = 10; // Interval for publishing the messages (in seconds) +const int INTERVAL = 5; // Interval for publishing the messages (in seconds) char message_buff[100]; @@ -111,7 +111,7 @@ while(1) { t = time(NULL); - if(t > (lastTime + 5)) { + if(t > (lastTime + INTERVAL)) { lastTime = t; if(connected) { mqttClient.publish("example/hello", payload);