Skip to content

Commit 6a0723b

Browse files
committed
remove analog
remove unnecessary comments
1 parent 353f89e commit 6a0723b

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/main.cpp

+2-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <ArduinoJson.h>
77
#include "WiFi.h"
88

9-
// The MQTT topics that this device should publish/subscribe
109
#define AWS_IOT_PUBLISH_TOPIC "esp32/pub"
1110
#define AWS_IOT_SUBSCRIBE_TOPIC "esp32/sub"
1211

@@ -37,16 +36,14 @@ void connectAWS()
3736
}
3837

3938
Serial.println("Connecting AWS");
40-
// Configure WiFiClientSecure to use the AWS IoT device credentials
39+
4140
net.setCACert(AWS_CERT_CA);
4241
net.setCertificate(AWS_CERT_CRT);
4342
net.setPrivateKey(AWS_CERT_PRIVATE);
4443

4544
Serial.println("Connecting to Endpoint");
46-
// Connect to the MQTT broker on the AWS endpoint we defined earlier
4745
client.setServer(AWS_IOT_ENDPOINT, 8883);
4846

49-
// Create a message handler
5047
client.setCallback(messageHandler);
5148

5249
Serial.print("Connecting to AWS IOT");
@@ -62,7 +59,6 @@ void connectAWS()
6259
}
6360

6461
Serial.print("Subscribing to the topic");
65-
// Subscribe to a topic
6662
client.subscribe(AWS_IOT_SUBSCRIBE_TOPIC);
6763

6864
Serial.println("AWS IoT Connected!");
@@ -72,9 +68,8 @@ void publishMessage()
7268
{
7369
StaticJsonDocument<200> doc;
7470
doc["time"] = millis();
75-
doc["sensor_a0"] = analogRead(0);
7671
char jsonBuffer[512];
77-
serializeJson(doc, jsonBuffer); // print to client
72+
serializeJson(doc, jsonBuffer);
7873

7974
client.publish(AWS_IOT_PUBLISH_TOPIC, jsonBuffer);
8075
Serial.println("published");

0 commit comments

Comments
 (0)