Servo - convert writeMicroseconds to write angle

Does anyone know the math to figure out how to get the servo write() angle out of the writeMicroseconds number?

Thank you in advance! ^^

Does anyone know the math to figure out how to get the servo write() angle out of the writeMicroseconds number?

Why do you need to? The process is exactly the same as mapping from angle to microseconds, except that the ranges are swapped.

If in doubt, look at the source.

And in reality the servo library mapping is a crude assumption on the part of the servo library because it assumes all servos have the same physical positioning range using the same minimum and maximum pulse width values, which is simply not the case.

If one wants servo.write(degrees) to accurately move the servo in real degree steps then they must carefully test their specific servo(s) and supply the servo library with the correct minimum and maximum pulse widths and build their own mapping to the physical travel limits for the servos being used. servo.writeMicroseconds() is your friend to gain the information needed to have well characterized servo movements possible in your projects.

Lefty