File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
src/examples/mqtt_polling_aws Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 1616// Tool allows for publishing and subscribing on thing_id/topic. If you want to
1717// publish and subscribe on other topics, see the AWS IoT Core Policy
1818// documentation.
19- #define MQTT_SUB_TOPIC_FMT " %s/mchp_topic_sub "
19+ #define MQTT_SUB_TOPIC_FMT " %s/sensors "
2020#define MQTT_PUB_TOPIC_FMT " %s/sensors"
2121
2222char mqtt_sub_topic[128 ];
@@ -94,7 +94,6 @@ bool initMQTTTopics() {
9494
9595void setup () {
9696 Log.begin (115200 );
97- Log.setLogLevel (LogLevel::DEBUG);
9897 LedCtrl.begin ();
9998 LedCtrl.startupCycle ();
10099
@@ -120,15 +119,15 @@ void loop() {
120119 // new message
121120
122121 if (message != " " ) {
123- Log.info (" Got new message: " );
124- Log.info (message);
125- Log.info (" \r\n " );
122+ Log.infof (" Got new message: %s\r\n " , message.c_str ());
126123 }
127124
128125 bool publishedSuccessfully =
129126 MqttClient.publish (mqtt_pub_topic, " {\" light\" : 9, \" temp\" : 9}" );
130127
131- if (!publishedSuccessfully) {
128+ if (publishedSuccessfully) {
129+ Log.info (" Published message" );
130+ } else {
132131 Log.error (" Failed to publish\r\n " );
133132 }
134133 } else {
You can’t perform that action at this time.
0 commit comments