33
44 This example connects to a MQTT broker and subscribes to a single topic,
55 it also publishes a message to another topic every 10 seconds.
6- When a message is received it prints the message to the serial monitor ,
6+ When a message is received it prints the message to the Serial Monitor ,
77 it uses the callback functionality of the library.
88
99 It also demonstrates how to set the will message, get/set QoS,
1010 duplicate and retain values of messages.
1111
1212 The circuit:
13- - Arduino MKR 1000, MKR 1010 or Uno WiFi Rev.2 board
13+ - Arduino MKR 1000, MKR 1010 or Uno WiFi Rev2 board
1414
1515 This example code is in the public domain.
1616*/
2626
2727#include " arduino_secrets.h"
2828// /////please enter your sensitive data in the Secret tab/arduino_secrets.h
29- char ssid[] = SECRET_SSID; // your network SSID (name)
29+ char ssid[] = SECRET_SSID; // your network SSID (name)
3030char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP)
3131
3232// To connect with SSL/TLS:
@@ -56,7 +56,7 @@ void setup() {
5656 ; // wait for serial port to connect. Needed for native USB port only
5757 }
5858
59- // attempt to connect to Wifi network:
59+ // attempt to connect to WiFi network:
6060 Serial.print (" Attempting to connect to WPA SSID: " );
6161 Serial.println (ssid);
6262 while (WiFi.begin (ssid, pass) != WL_CONNECTED) {
@@ -68,7 +68,7 @@ void setup() {
6868 Serial.println (" You're connected to the network" );
6969 Serial.println ();
7070
71- // You can provide a unique client ID, if not set the library uses Arduin -millis()
71+ // You can provide a unique client ID, if not set the library uses Arduino -millis()
7272 // Each client must have a unique client ID
7373 // mqttClient.setId("clientId");
7474
@@ -79,8 +79,8 @@ void setup() {
7979 // you can disable this behaviour by using
8080 // mqttClient.setCleanSession(false);
8181
82- // set a will message, used by the broker when the connection dies unexpectantly
83- // you must know the size of the message before hand , and it must be set before connecting
82+ // set a will message, used by the broker when the connection dies unexpectedly
83+ // you must know the size of the message beforehand , and it must be set before connecting
8484 String willPayload = " oh no!" ;
8585 bool willRetain = true ;
8686 int willQos = 1 ;
@@ -110,7 +110,7 @@ void setup() {
110110 Serial.println ();
111111
112112 // subscribe to a topic
113- // the second parameter set's the QoS of the subscription,
113+ // the second parameter sets the QoS of the subscription,
114114 // the the library supports subscribing at QoS 0, 1, or 2
115115 int subscribeQos = 1 ;
116116
@@ -129,7 +129,7 @@ void loop() {
129129 // send MQTT keep alives which avoids being disconnected by the broker
130130 mqttClient.poll ();
131131
132- // avoid having delays in loop, we'll use the strategy from BlinkWithoutDelay
132+ // to avoid having delays in loop, we'll use the strategy from BlinkWithoutDelay
133133 // see: File -> Examples -> 02.Digital -> BlinkWithoutDelay for more info
134134 unsigned long currentMillis = millis ();
135135
0 commit comments