Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
calibrate example for Servo #49
base: master
Are you sure you want to change the base?
calibrate example for Servo #49
Changes from 2 commits
bb23457
6001753
4b31d2e
a928daa
e69088d
8819502
be98aac
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the line ending menu of Serial Monitor set to anything other than "No line ending", there is an issue. For example, if I enter 42 in the Serial Monitor input field, I get this output:
"Newline" is the default setting of this menu, so it's likely many users will encounter this problem.
The easiest solution would be to document the required line ending setting. Of course, many users won't read the directions, so they will still have the problem.
There is also the issue of the 1 s delay before the input takes effect. Not a huge issue, but it doesn't provide a very responsive feeling to the interface.
I explained the cause and described the fix for these issues here: #44 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok ill look into your suggestions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@per1234 should I mention in the document to use no line ending or should I try improvising code to work for newline?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue still occurs with the line ending menu set to "Both NL & CR".DONEThe reason is because serial communication is relatively slow.
Serial.parseInt()
returns as soon as it encounters a non-digit. So whenSerial.parseInt()
returns the NL has already been received, but the CR has not. The "remove the line endings" code you added removes the NL, thenSerial.available()
returns 0 so thewhile
loop exits. On the next time through theloop
function the CR is in the receive buffer, soSerial.parseInt()
returns 0 (because that's what it does when it doesn't encounter any digits).The solution is to add a short delay before the "remove the line endings" code to allow the CR to be received, as I demonstrated in #44 (comment).