BufferUntil example error
Closed this issue · 6 comments
In the following website:
http://processing.org/reference/libraries/serial/Serial_bufferUntil_.html
The example has an error where:
void serialEvent(Serial p) {
Should be:
void serialEvent(Serial myPort) {
I think it should be:
inString = (p.readString());
To reinforce there can be multiple events all happening through the same event function. But yes, there's an error in the example. I'm going to ask @gohai to weight in.
I agree,
void serialEvent(Serial p) {
inString = (p.readString());
}
is a better option
@REAS Concur. I'd also get rid of the extra parenthesis around p.readString(), since they don't add anything (we're simply assigning the function's return value to a global variable).
I am also aware of some other places in the Serial documentation that could need some improvement (e.g. the example for readBytes() uses both variants of the method, which makes it unsuitable for copy & paste and a bit hard to grasp what is going on) - will look more into this soon!
I have sent a pull request to fix this specific issue with the fix as discussed here.
@gohai Perhaps for other improvements to the Serial documentation you can file a new issue and/or pull request?
Thanks @AmnonOwed and @gohai