-
Notifications
You must be signed in to change notification settings - Fork 263
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
enlarge range for angle from 0 to 359 #70
Comments
I think is the same issue that i have... int Servo::read() // return the value as degrees
{
return map(readMicroseconds()+1, SERVO_MIN(), SERVO_MAX(), 0, 180);
} |
@dsyleixa, @hugoinfante83 You are aware that this won't actually change the travel range of the servo, right? IMHO the mentioning of Picking 180 for the maximum position can lead people to assume that it is in degrees, but 1000, 255, or 100 (like percent, but poorer resolution) might have been better choices. |
IMO the servo position to write or read should always match to its actual angle in degrees and nothing else, for either servo with either travel range. |
That would be ideal, and that's why I was asking about your expectations/use-case. Unfortunately, the library has no way to find out what the physical travel range of an attached servo is. That would be an easy change (e.g. adding the max 'angle' to the constructor) and could also be done in a backwards-compatible manner by using 180 as the default. |
yes, I know the servo's max travel range (e.g., 180° or 270° or 360°), the lib is just to handle the angles as they are programmed. |
I'd suggest adding an additional
The default The programmer could adjust this to fit the problem, like having a range from 0..270 or even -45..45. |
IMO that's a bad idea, the lib should provide the correct handsome features out of the box for either servo range. |
What sort of an API do you have in mind? You could always provide convenience functions on top of that, like But for my use-case having [-45, 45] would be ideal and IMO there's no reason that the API should prohibit that. |
hello,
will it be possible to enlarge the range for angle e.g. from 0 to 359 or at least from 0 to 270?
The default servo max angle= 180 should be possible to be changed arbitrarily for that purpose.
The text was updated successfully, but these errors were encountered: