Test

Dependencies:   Cayenne-MQTT-mbed ESP8266Interface mbed

Fork of Cayenne-ESP8266Interface by myDevicesIoT

Revision:
4:8d67c9a3a66a
Parent:
3:508b266e010c
Child:
5:e4607ebed2f3
diff -r 508b266e010c -r 8d67c9a3a66a main.cpp
--- a/main.cpp	Wed Oct 26 23:05:25 2016 +0000
+++ b/main.cpp	Fri Oct 28 00:09:24 2016 +0000
@@ -17,6 +17,9 @@
 char* password = "MQTT_PASSWORD";
 char* clientID = "CLIENT_ID";
 
+// Use Cayenne IP instead of "mqtt.mydevices.com" since the ESP8266Interface doesn't support looking up the domain name.
+#define CAYENNE_IP "57.7.250.10"
+
 ESP8266Interface interface(D8, D2, D3, ssid, wifiPassword, 115200); // TX, RX, Reset, SSID, Password, Baud
 MQTTNetwork<ESP8266Interface> network(interface);
 CayenneMQTT::MQTTClient<MQTTNetwork<ESP8266Interface>, MQTTTimer> mqttClient(network, username, password, clientID);
@@ -92,8 +95,8 @@
 {
     int error = 0;
     // Connect to the server.
-    printf("Connecting to %s:%d\n", CAYENNE_DOMAIN, CAYENNE_PORT);
-    while ((error = network.connect(CAYENNE_DOMAIN, CAYENNE_PORT)) != 0) {
+    printf("Connecting to %s:%d\n", CAYENNE_IP, CAYENNE_PORT);
+    while ((error = network.connect(CAYENNE_IP, CAYENNE_PORT)) != 0) {
         printf("TCP connect failed, error: %d\n", error);
         wait(2);
     }