Hey,
I am trying to check communication through serial between the Portenta H7 and the Cat M1 shield.
I do an AT command which returns (print into its Serial)
AT+CFUN=1,1
OK
^SYSSTART
(I voluntarily copy/pasted with blank spaces).
Firstly I have this code:
unsigned long end = millis() + TIMEOUT;
this->debug.log("await -> " + delimiter + " || timeout -> " + String(end) + "ms");
String input = "";
bool found = false;
while( true ){
if( ModemSerial.available() ){
String line = ModemSerial.readStringUntil('\n');
input += line;
// Delimiter found in new line
if( this->test(line, delimiter) ){
found = true;
break;
}
}
// Delimiter found in whole input
if( this->test(input, delimiter) ){
found = true;
break;
}
// Timeout reached
if( millis() > end ) break;
}
this->debug.log("await input -> " + input);
return found ? input : "";
Which works and found the string I am searching ("^SYSSTART").
But I want to then check from another place if the returned String contains "^SYSSTART" to create a bool but the 'response.indexOf("^SYSSTART")' now fails...
Why the .indexOf() fail to find the string despite me seeing it well in the Serial Monitor ?