This is example for openHAB with MQTT
Dependencies: DHT MQTT WIZnetInterface mbed
Fork of w7500-paho-mqtt by
Revision 17:d07286cd2088, committed 2016-02-24
- Comitter:
- kaizen
- Date:
- Wed Feb 24 00:00:20 2016 +0000
- Parent:
- 16:3bd1b60a8a21
- Commit message:
- changed interval
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 3bd1b60a8a21 -r d07286cd2088 main.cpp --- a/main.cpp Tue Dec 29 07:35:33 2015 +0000 +++ b/main.cpp Wed Feb 24 00:00:20 2016 +0000 @@ -55,15 +55,21 @@ int main (void) { DHT sensor(D4, DHT11); + DigitalOut myled(LED1); + sw1 = 0; sw2 = 0; sw3 = 0; baud(115200); printf("Wait a second...\r\n"); + + myled = 0; + MQTTEthernet ipstack = MQTTEthernet(); printf("IP Address : %s\r\n",ipstack.getEth().getIPAddress()); MQTT::Client<MQTTEthernet, Countdown> client = MQTT::Client<MQTTEthernet, Countdown>(ipstack); - char* hostname = "192.168.0.100"; + char* hostname = "192.168.1.213"; + printf("connect to %s\r\n",hostname); int port = 1883; int rc = ipstack.connect(hostname, port); @@ -144,7 +150,7 @@ rc = client.publish("/wiznet/temperature", message); printf("publish temperature data %s\r\n",(char*)message.payload); - client.yield(60000); + client.yield(5000); } }