// SafeString_Example1b.ino // install the SafeString library from the Arduino Library manager or // download and install the SafeString zip file from // www.forward.com.au/pfod/ArduinoProgramming/SafeString/index.html #include "SafeString.h" createSafeString(msgStr, 10); // increased to capacity of 10 void setup() { // Open serial communications and wait a few seconds Serial.begin(9600); for (int i = 10; i > 0; i--) { Serial.print(' '); Serial.print(i); delay(500); } Serial.println(); //SafeString::setOutput(Serial); // do NOT enable error messages and debug() output to be sent to Serial if (SafeString::errorDetected()) { while (1) { Serial.println(F("Error is SafeString globals!!")); delay(3000); } } } void loop() { msgStr = F("A0"); msgStr += " = "; msgStr += analogRead(A0); // add the reading msgStr.debug(F(" After adding analogRead ")); // print debug info Serial.println(msgStr); // output the result while (1) { // stop here delay(1); // add delay(1) to prevent ESP32 reboots } }