just trying to print the strings before and after then character replacement
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
String reportString = "SensorReading: 456";
Serial.print(reportString);
int colonPosition = reportString.indexOf(':');
reportString.setCharAt(colonPosition, '=');
Serial.print(reportString);
void loop() {
// put your main code here, to run repeatedly:
}
error-report 04-14-20.txt (6.37 KB)
this
String reportString = "SensorReading: 456";
Serial.print(reportString);
int colonPosition = reportString.indexOf(':');
reportString.setCharAt(colonPosition, '=');
Serial.print(reportString);
is OUTSIDE setup() or loop(). they should be inside EITHER function.
like this:
(compiles not test)
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
String reportString = "SensorReading: 456";
Serial.print(reportString);
int colonPosition = reportString.indexOf(':');
reportString.setCharAt(colonPosition, '=');
Serial.print(reportString);
}
void loop() {
// put your main code here, to run repeatedly:
}
hope that helps
[/quote]