The following programming line results in: stray '/342' in program error:
String msg = soft.readStringUntil(‘\h’);
Any suggestions as to correct this error. Thanks
The following programming line results in: stray '/342' in program error:
String msg = soft.readStringUntil(‘\h’);
Any suggestions as to correct this error. Thanks
Welcome to the forum
At a guess the code was copied from a Web page and contains Unicode characters that the IDE can't handle
The single quotes around \h look suspiciously like the culprits. Delete them and use the apostrophe character instead
Originally ‘\h’
With apostrophes '\h'
Note the subtle difference
The most common reason for this error is an incorrect copy-paste of the code from a web page.
Try erasing this line from the sketch completely and re-typing it letter by letter.
Your topic was MOVED to its current forum category which is more appropriate than the original as it has nothing to do with Installation and Troubleshooting of the IDE
Thank you for your help with ('\h'); it is a detail of which I would not have been aware.
The solution revealed a further problem: 'Sketch_ju126a does not name a type.'
Sketch_jul26a
#include <SoftwareSerial.h>
SoftwareSerial.soft(10, 11); //Rx, Tx
void setup() {
Serial.begin(9600);
soft.begin(9600);
}
void loop() {
String msg = soft.readStringUntil('\h');
Serial.print(msg);
}
My book 'Programming Arduino' does not cover 'qsort'
Thank you for any advice that you can give.
I think this should be
#include <SoftwareSerial.h>
SoftwareSerial.soft(10, 11); //Rx, Tx
void setup() {
Serial.begin(9600);
soft.begin(9600);
}
void loop() {
String msg = soft.readStringUntil('\n');
Serial.print(msg);
}
I don;t see qsort in your code
Sketch_jul26a is not a valid programming command.
The // makes it a comment line, that will be ignored by the system
//Sketch_jul26a
Thank you for coming back.
‘qsort’ came-up when I ‘copied error message’ in the first-post. I had not come-across this command before.
Also in the present code there is ‘Until’. My book does not mention that either.
A new error message is ‘Expected unqualified -id before ‘.’ token.’
You help is appreciated.
Where are you getting this syntax for Software Serial?
See the documentation
#include <SoftwareSerial.h>
SoftwareSerial soft(10, 11); //Rx, Tx
To Cattledog,
Thank you for the information. On your suggestion, I found the syntax for this software in ‘Software Serial’. I will know what to do next time.
pandabears
To Cattledog,
Thank you for the information. On your suggestion, I found the syntax for this software in ‘Software Serial’. I will know what to do next time.
pandabears