MQTT

Dependencies:   ESP8266Interface3 MQTT mbed-rtos mbed

Fork of ESP8266_MQTT_HelloWorld by ESP8266

Revision:
19:cff20f14096e
Parent:
18:76d0899bc3ce
--- a/main.cpp	Tue Jun 09 17:57:43 2015 +0000
+++ b/main.cpp	Mon Feb 06 08:34:14 2017 +0000
@@ -24,12 +24,20 @@
 
 */
 
+#include <test.h>
+#include "mbed.h"
+
+//DigitalOut PWD(PTB2);  waar wordt deze pin dan gezet
+DigitalOut G15(PTB11);
 
 #include "MQTTESP8266.h"
 #include "MQTTClient.h"
 
 int arrivedcount = 0;
 
+char data[100];
+int cnt = 0; 
+
 // callback for subscribe topic
 void subscribeCallback(MQTT::MessageData& md)
 {
@@ -42,16 +50,19 @@
 // main function that sets up the subscription and makes a couple publishes
 int main(int argc, char* argv[])
 {
-    printf("Starting\n");
-    MQTTESP8266 ipstack(D1, D0, D10, "demossid","passphrase"); // change to match your wifi access point
-    float version = 0.47;
-    char* topic = "mbed-sample";
+    //PWD = 1;  dit is de reset pin
+    G15 = 0;
+ 
+    printf("Starting  MQTT\n");
+    MQTTESP8266 ipstack(PTD3,PTD2,PTB2, "QBMT","zoranetwerk"); // change to match your wifi access point PTD9 is fake pin
+    float version = 0.51;
+    char* topic = "mbe d-sample";
 
     printf("Version is %f\n", version);
-
+    
     MQTT::Client<MQTTESP8266, Countdown> client = MQTT::Client<MQTTESP8266, Countdown>(ipstack);
 
-    char* hostname = "85.119.83.194"; // test.mosquitto.org
+    char* hostname = "192.168.1.103"; // test.mosquitto.org
     int port = 1883;
     int rc = ipstack.connect(hostname, port);
     if (rc != 0)
@@ -59,9 +70,9 @@
 
     MQTTPacket_connectData data = MQTTPacket_connectData_initializer;
     data.MQTTVersion = 3;
-    data.clientID.cstring = "mbed-clientID";
-    data.username.cstring = "testuser";
-    data.password.cstring = "testpassword";
+    data.clientID.cstring = "blownelco";
+    data.username.cstring = "";
+    data.password.cstring = "";
     if ((rc = client.connect(data)) != 0)
         printf("rc from MQTT connect is %d\n", rc);