ME910 changes
Dependencies: Cayenne-MQTT-mbed-M1 X_NUCLEO_IKS01A1 mbed mtsas-m1
Fork of 5_Dragonfly_Cayenne_Sprint_IKS01A1 by
Diff: main.cpp
- Revision:
- 3:a40321269c7f
- Parent:
- 2:abc89d2aede3
- Child:
- 4:2b412949efb9
diff -r abc89d2aede3 -r a40321269c7f main.cpp --- a/main.cpp Tue Apr 25 21:01:51 2017 +0000 +++ b/main.cpp Tue Apr 25 22:00:32 2017 +0000 @@ -182,7 +182,7 @@ // Set the onboard LED state Led1Out = atoi(lastMessage.getValue()); // Publish the updated LED state - if ((error = mqttClient.publishData(DATA_TOPIC, lastMessage.channel, NULL, NULL, lastMessage.getValue())) != CAYENNE_SUCCESS) { + if ((error = mqttClient.publishData(DATA_TOPIC, lastMessage.channel, NULL, NULL, Led1Out.read())) != CAYENNE_SUCCESS) { printf("Publish LED state failure, error: %d\r\n", error); } break; @@ -209,7 +209,6 @@ // Publish some example data every few seconds. This should be changed to send your actual data to Cayenne. if (timer.expired()) { - Led1Out = 1; int error = 0; float temp_data; temp_sensor1->get_temperature(&temp_data); @@ -228,7 +227,7 @@ printf("Publish barometric pressure failed, error: %d\r\n", error); } printf("Led is: %s\r\n", Led1Out.read() ? "on" : "off"); - if ((error = mqttClient.publishData(DATA_TOPIC, 4, "led", UNIT_DIGITAL, Led1Out.read())) != CAYENNE_SUCCESS) { + if ((error = mqttClient.publishData(DATA_TOPIC, 0, "digital_actuator", UNIT_DIGITAL, Led1Out.read())) != CAYENNE_SUCCESS) { printf("Publish LED status failed, error: %d\r\n", error); } // Restart the countdown timer for publishing data every 5 seconds. Change the timeout parameter to publish at a different interval.