servo.h not taking float values for servo angle?

Not quite sure if this is the correct section but it was the only one mentioning libraries so I'll give it a try.

Thing is that I'm testing the precision of a servo and I see it jumping a little every once in a while when I parse it values from a curve with increasing speed.

I'm still rather new to electronics and I know that there can be several other factors influencing this but I'm curious as to why you can only input int values to the servo library when my logic tells me PWM should be able to handle floats as well? Is this due to the harder handling of float values compared to char/int (through serial for instance) or that such precision weren't deemed necessary? or some other limitations that I'm unaware of? If not, I'll prolly do my own servo implementation that accounts for float as well but thought I'd ask here first, before wasting too much time on an optimization that wont be visible anyway

bottom line is that I'm aiming for a way to achieve the smoothest arch possible with de- and accelerations through a servo.

And as a sidenote, if anyone can recommend a servo able to move quickly and precise - not necessarily high torque - I would be very interested :)


In general we try to avoid float values in the core libraries because they add a lot of size to your sketch (as the calculations are all done in software). You can use the writeMicroseconds() function for more precision: