![](/media/cache/group/myDevicesLogo.png.50x50_q85.png)
Example for connecting to Cayenne using the ESP8266Interface library.
Dependencies: Cayenne-MQTT-mbed ESP8266Interface mbed
Diff: main.cpp
- Revision:
- 5:e4607ebed2f3
- Parent:
- 4:8d67c9a3a66a
- Child:
- 6:b90ebca0de01
diff -r 8d67c9a3a66a -r e4607ebed2f3 main.cpp --- a/main.cpp Fri Oct 28 00:09:24 2016 +0000 +++ b/main.cpp Fri Nov 04 19:29:31 2016 +0000 @@ -149,13 +149,13 @@ // Publish some example data every few seconds. This should be changed to send your actual data to Cayenne. if (timer.expired()) { int error = 0; - if ((error = mqttClient.publishData(DATA_TOPIC, 0, TEMPERATURE, CELSIUS, 30.5)) != CAYENNE_SUCCESS) { + if ((error = mqttClient.publishData(DATA_TOPIC, 0, TYPE_TEMPERATURE, UNIT_CELSIUS, 30.5)) != CAYENNE_SUCCESS) { printf("Publish temperature failed, error: %d\n", error); } - if ((error = mqttClient.publishData(DATA_TOPIC, 1, LUMINOSITY, LUX, 1000)) != CAYENNE_SUCCESS) { + if ((error = mqttClient.publishData(DATA_TOPIC, 1, TYPE_LUMINOSITY, UNIT_LUX, 1000)) != CAYENNE_SUCCESS) { printf("Publish luminosity failed, error: %d\n", error); } - if ((error = mqttClient.publishData(DATA_TOPIC, 2, BAROMETRIC_PRESSURE, HECTOPASCAL, 800)) != CAYENNE_SUCCESS) { + if ((error = mqttClient.publishData(DATA_TOPIC, 2, TYPE_BAROMETRIC_PRESSURE, UNIT_HECTOPASCAL, 800)) != CAYENNE_SUCCESS) { printf("Publish barometric pressure failed, error: %d\n", error); } timer.countdown_ms(5000);