Published

Dependencies:   DHT MQTTforLecture WIZnetInterface mbed-src

Fork of w7500-paho-mqtt by Bohyun Bang

Files at this revision

API Documentation at this revision

Comitter:
bangbh
Date:
Mon Sep 21 23:39:16 2015 +0000
Parent:
14:2b30a541da82
Commit message:
for lecture

Changed in this revision

MQTT.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/MQTT.lib	Sun Sep 20 06:11:10 2015 +0000
+++ b/MQTT.lib	Mon Sep 21 23:39:16 2015 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/users/bangbh/code/MQTTforLecture/#85fefcf0b231
+https://developer.mbed.org/users/bangbh/code/MQTTforLecture/#4d790a810311
--- a/main.cpp	Sun Sep 20 06:11:10 2015 +0000
+++ b/main.cpp	Mon Sep 21 23:39:16 2015 +0000
@@ -28,7 +28,6 @@
     AnalogIn ain(A1);
     baud(115200);
     printf("Wait a second...\r\n");
-    char* topic = "hello/wiznet";
     MQTTEthernet ipstack = MQTTEthernet();
     
     MQTT::Client<MQTTEthernet, Countdown> client = MQTT::Client<MQTTEthernet, Countdown>(ipstack);
@@ -40,11 +39,12 @@
     if (rc != 0)
         printf("rc from TCP connect is %d\n", rc);
         
-    printf("Topic: %s\r\n",topic);
+    char MQTTClientID[30];
     
     MQTTPacket_connectData data = MQTTPacket_connectData_initializer;       
     data.MQTTVersion = 3;
-    sprintf(data.clientID.cstring,"WIZwiki-W7500-client-%d",rand()%1000);
+    sprintf(MQTTClientID,"WIZwiki-W7500-client-%d",rand()%1000);
+    data.clientID.cstring = MQTTClientID;
     data.username.cstring = "testuser";
     data.password.cstring = "testpassword";