I've got a Raspberry Pi with which I control a servo. The servo controlls the rudder in an autonomous boat I'm building. I'm using Golang and this gpio library to control the PWM.
The input I get from the program ranges from -100 (full left) to 100 (full right). I've got some code (proof-of-concept) which works great (paste here).
- a frequency of 100
- a cycle length of 100
- I vary the duty cycle between 3 (full left) and 14 (full right).
This works great, but since the library only accepts ints as input for the duty cycle, I only have 11 discrete steps to which the servo can be set. I would like to be able to have more fine grained control though. I would like to use a minimum of about 25 discrete steps.
So I played around with the numbers of the frequency, the cycle length and the duty cycle minimum and maximum, but I really can't get more steps.
Could anybody give me some hints as to how I can create more discrete steps? All tips are welcome!
So far so good.