also played a bit with * and & as a placeholder - no way, it does not get recognized.
Any idea which comparison would work fine? (Placeholder or termination characters)
"Why do you instead not.." :
I am aware I could create a char and so an, but as I also want the code to be compatible to ESPs, I´d like to stick to the String solution. I also could expand startsWith , but this would result in lots of wasted bytes.
I also try to avoid any cropping cutting whatever, as this would result in (minimun one) extra step.
Serial.readStringUntil('\n');
reads \n but doesn't append it.
does the IR send lline end characters?
the readStringUntil ends after timeout if no more characters arrive. default timeout is 1 second
Juraj:
Serial.readStringUntil('\n');
reads \n but doesn't append it.
does the IR send lline end characters?
the readStringUntil ends after timeout if no more characters arrive. default timeout is 1 second
Very good point, just re-checked the ir sketch.
Putting the same to string which is sended results in the 8 character string "20DF8877". I.e. on the IR receiving and RX TX sending Arduino:
Serial.println(results.value, HEX);
String t = String(results.value, HEX);
Serial.println(t);
Serial.println(t.length());
prints out
20DF8877
20DF8877
8
after receiving it on the second one, it is then 10 characters long and also prints 20DF8877.
Serial.readStringUntil('\n') responds very fast and does not delay a second. Serial.readString on the other hand, has the one second delay.
delay on ir receive loop seemed to be too high. Set it from delay(100) to delay(10), which results in receiving a 9 character string. Does not make much sense to me - however:
.endsWith("8877\r") now triggers fine
Also checked if .readStringUntil('\r'); would result in 8 character string - it does not, I directly get the one second delay. Seems the /r is applied by the readString function.
Inso:
Also checked if .readStringUntil('\r'); would result in 8 character string - it does not, I directly get the one second delay. Seems the /r is applied by the readString function.
didn't you mix up the experiments?
sure is readString doesn't end on \r, only on timeout.
readStringUntil('\r'); doesn't put \r into result String