As for the numbers I showed, the 0x8585 was from your code, although I did get it wrong:
Wire.write(85);
Wire.write(85);
So the actual value: given is 85*256=85=21845 = 0x5555 I believe only the low 3 bits is use of high byte: so this is 0x555 or 1365...
As for pulse width:
If you go to the libraries example program servo.ino you see:
Code:
void setServoPulse(uint8_t n, double pulse) {
double pulselength;
pulselength = 1000000; // 1,000,000 us per second
pulselength /= 60; // 60 Hz
Serial.print(pulselength); Serial.println(" us per period");
pulselength /= 4096; // 12 bits of resolution
Serial.print(pulselength); Serial.println(" us per bit");
pulse *= 1000000; // convert to us
pulse /= pulselength;
Serial.println(pulse);
pwm.setPWM(n, 0, pulse);
}
Again I was assuming 60hz as per their code...
So if you pass in .0015 as the pulse width which internally multiply by 1000000 = 1500
and you divide this by pulselength= (1000000/60)/4096 = 4.0690104166666666666666666666667
so 1500/4.06... = 368 then you need to convert to bytes...
Now with 50hz instead of 60, I would suspect a value of about 307 (same calculations substitute 50 for 60...)
As for +-5 degrees. A lot of the may depend on what servos you are using? How much slop...
If you are doing 50 hz and the range of valid values is 0-4095, than a change of 1 in the output will change the pulse width by about 5us (4.8...)
But lets assume that your servos have a valid range of output of 500(-90 degrees) 1500(0) 2500(90 degrees), I would suspect that the valid data to
pass as pulse widths is: 102 - 512 So about a difference of 410 so 180 degrees/410=.439 degrees per unit...
But this really depends on your servos. Also not all are linear... So yes you may need to use your own observations to do the valid conversions. Also if you have different brands/model numbers, the conversion may be different for each of them.
Warning it has probably been 5 years since I did much of anything with RC servos!