Skip to content

Commit

Permalink
chore: Enable logging earlier in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
zfields committed Sep 10, 2024
1 parent a4b00a8 commit 48c9bac
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 5 deletions.
10 changes: 9 additions & 1 deletion examples/ArduinoIoTCloud-Advanced/ArduinoIoTCloud-Advanced.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,21 @@ void setup() {
Serial.begin(9600);
for(unsigned long const serialBeginTime = millis(); !Serial && (millis() - serialBeginTime <= 5000); ) { }

/* Set the debug message level:
* - DBG_ERROR: Only show error messages
* - DBG_WARNING: Show warning and error messages
* - DBG_INFO: Show info, warning, and error messages
* - DBG_DEBUG: Show debug, info, warning, and error messages
* - DBG_VERBOSE: Show all messages
*/
setDebugMessageLevel(DBG_INFO);

/* This function takes care of connecting your sketch variables to the ArduinoIoTCloud object */
initProperties();

/* Initialize Arduino IoT Cloud library */
ArduinoCloud.begin(ArduinoIoTPreferredConnection);

setDebugMessageLevel(DBG_INFO);
ArduinoCloud.printDebugInfo();
}

Expand Down
10 changes: 9 additions & 1 deletion examples/ArduinoIoTCloud-Basic/ArduinoIoTCloud-Basic.ino
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ void setup() {
Serial.begin(9600);
for(unsigned long const serialBeginTime = millis(); !Serial && (millis() - serialBeginTime <= 5000); ) { }

/* Set the debug message level:
* - DBG_ERROR: Only show error messages
* - DBG_WARNING: Show warning and error messages
* - DBG_INFO: Show info, warning, and error messages
* - DBG_DEBUG: Show debug, info, warning, and error messages
* - DBG_VERBOSE: Show all messages
*/
setDebugMessageLevel(DBG_INFO);

/* Configure LED pin as an output */
pinMode(LED_BUILTIN, OUTPUT);

Expand All @@ -34,7 +43,6 @@ void setup() {
/* Initialize Arduino IoT Cloud library */
ArduinoCloud.begin(ArduinoIoTPreferredConnection);

setDebugMessageLevel(DBG_INFO);
ArduinoCloud.printDebugInfo();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ void setup() {
Serial.begin(9600);
for(unsigned long const serialBeginTime = millis(); !Serial && (millis() - serialBeginTime <= 5000); ) { }

/* Set the debug message level:
* - DBG_ERROR: Only show error messages
* - DBG_WARNING: Show warning and error messages
* - DBG_INFO: Show info, warning, and error messages
* - DBG_DEBUG: Show debug, info, warning, and error messages
* - DBG_VERBOSE: Show all messages
*/
setDebugMessageLevel(DBG_INFO);

/* This function takes care of connecting your sketch variables to the ArduinoIoTCloud object */
initProperties();

Expand All @@ -51,7 +60,6 @@ void setup() {
ArduinoCloud.addCallback(ArduinoIoTCloudEvent::SYNC, doThisOnSync);
ArduinoCloud.addCallback(ArduinoIoTCloudEvent::DISCONNECT, doThisOnDisconnect);

setDebugMessageLevel(DBG_INFO);
ArduinoCloud.printDebugInfo();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ void setup() {
Serial.begin(9600);
for(unsigned long const serialBeginTime = millis(); !Serial && (millis() - serialBeginTime <= 5000); ) { }

/* Set the debug message level:
* - DBG_ERROR: Only show error messages
* - DBG_WARNING: Show warning and error messages
* - DBG_INFO: Show info, warning, and error messages
* - DBG_DEBUG: Show debug, info, warning, and error messages
* - DBG_VERBOSE: Show all messages
*/
setDebugMessageLevel(DBG_INFO);

/* Configure LED pin as an output */
pinMode(LED_BUILTIN, OUTPUT);

Expand All @@ -70,7 +79,6 @@ void setup() {
/* Setup OTA callback */
ArduinoCloud.onOTARequestCb(onOTARequestCallback);

setDebugMessageLevel(DBG_INFO);
ArduinoCloud.printDebugInfo();
}

Expand Down
10 changes: 9 additions & 1 deletion examples/ArduinoIoTCloud-Schedule/ArduinoIoTCloud-Schedule.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ void setup() {
Serial.begin(9600);
for(unsigned long const serialBeginTime = millis(); !Serial && (millis() - serialBeginTime <= 5000); ) { }

/* Set the debug message level:
* - DBG_ERROR: Only show error messages
* - DBG_WARNING: Show warning and error messages
* - DBG_INFO: Show info, warning, and error messages
* - DBG_DEBUG: Show debug, info, warning, and error messages
* - DBG_VERBOSE: Show all messages
*/
setDebugMessageLevel(DBG_INFO);

/* Configure LED pin as an output */
pinMode(LED_BUILTIN, OUTPUT);

Expand All @@ -26,7 +35,6 @@ void setup() {
/* Initialize Arduino IoT Cloud library */
ArduinoCloud.begin(ArduinoIoTPreferredConnection);

setDebugMessageLevel(DBG_INFO);
ArduinoCloud.printDebugInfo();

/* Setup one shot schedule example */
Expand Down

0 comments on commit 48c9bac

Please sign in to comment.