Test
Dependencies: Cayenne-MQTT-mbed ESP8266Interface mbed
Fork of Cayenne-ESP8266Interface by
Revision 4:8d67c9a3a66a, committed 2016-10-28
- Comitter:
- jburhenn
- Date:
- Fri Oct 28 00:09:24 2016 +0000
- Parent:
- 3:508b266e010c
- Child:
- 5:e4607ebed2f3
- Commit message:
- Use Cayenne IP instead of domain name.
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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);
}
