readString is EXTREMEMLY SLOW! Also the fact that readStringUntil('\n') doesnt count the \n, a big problem for my ESP32 Serial Terminal. Yea, I know the fact that why we SHOULDNT set timeout to 0, In VB.NET back then, I had an UNO and I was trying to make a something sends a whole .txt to arduino using serial, Normally VB.NET didnt had cooldown resulting in a big problem,
Is it, or do you just have a crazy long timeout ?
Hard to tell, because once again, we can't see your code.
didnt set any.
Then you add it in the received string, if needed.
Have a look at example 2 from this discussion https://forum.arduino.cc/t/serial-input-basics-updated/382007
It also does not include the terminating newline ('\n') but can easily be modified to change that.
how!?!?!
take a view here to gain the knowledge:
So, you got the default one.
idea=editing arduino.h
Great idea.
Go for it.
why not append the \n as well as the terminating \0? and avoid the timeout
nah edited it
If this means you modified some ardiuno-core file
this is counterproductive for your style of forum-communication
Whenever a new problem occurs that is related to this issue you would have to post the modified complete source-code-file as a code-section. Which seems something you don't like to do.
But I guess you don't care at the moment because at the moment your actual problem is solved.
(Though it is very likely that working this way will cause problems in the future)
Apart from the usual ‘don’t use Strings’ argument, the real answer here is that native serial comms are generally a very reliable but clunky way to transfer data.
Using serial with strings in any form is quite tedious if you do it properly.
Mainly because it’s slow compared to the processing capabilities of the cpu.
If you intend to use serial in earnest for any computer application, the best time you can spend is to write robust serial processor/parser functions as soon as you can, as part of your toolkit.
Strings as they stand are an ‘entry level attempt’ at doing this, but a real string handler by any name is both fast and flexible - and fault tolerant.
There is one that is fault tolerant and even offers debugging:
though for the price of using some extra memory.
The safeString-library
best regards Stefan
bruh. cant find the .h, BUT I ASK TO BARD AI TO GIVE THE CODE AND IT GAVE, THEN I EDIT!?!?!
Can't argue with that.
I agree the safe_String library has evolved nicely, but it doesn’t address command line processing or parsing a sentence meaningfully, you still have to write that code, and that’s where a lot of developers fall over. To do it properly isn’t easy.
too short to be understandable.
not understandable too.
An AI has endless patience. You can ask an AI such garbled half-sentences and they will always answer you. ALWAYS. But you will have to do a lot more editing than if you followed the forum rules.
tips how to improve your posting style
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.