Hi All !
I am working on a project using a pyboard and servos.
I would be very interested in having the detailed code for the pyb.Servo library.
I have spend much time searching it, but I haven't found it yet....
Where could I find it?
Thank you very much!
Simon
Detailed code for the pyb.Servo library
Re: Detailed code for the pyb.Servo library
It's written in C. You'll find the code in this file: https://github.com/micropython/micropyt ... al/servo.c
You can also control servos by using pwm like what's done here: https://github.com/dhylands/upy-example ... ic_test.py
You can also control servos by using pwm like what's done here: https://github.com/dhylands/upy-example ... ic_test.py
Re: Detailed code for the pyb.Servo library
Hi dhylands!
Thank you for your answer.
Actually, I have already implemented three functions in order to control my eight servos:
The first one generates PWM (I have adapted the PWM generation presented in the Quick Ref of the pyboard), the second one converts angles (in degrees) into a pulse width percent, and the third one allows me to control my servos by giving an angle order, and not a pwpercent.
My problem is following:
When I call the latter function several times with a short delay between each call (1 sec), the servo doesn't rotate continuously but step by step. And if the order remains the same, it "jerks" each second.
I don't have this problem when I use the Servo(X).angle() function.
Do you have any idea?
Thank you for your answer.
Actually, I have already implemented three functions in order to control my eight servos:
The first one generates PWM (I have adapted the PWM generation presented in the Quick Ref of the pyboard), the second one converts angles (in degrees) into a pulse width percent, and the third one allows me to control my servos by giving an angle order, and not a pwpercent.
My problem is following:
When I call the latter function several times with a short delay between each call (1 sec), the servo doesn't rotate continuously but step by step. And if the order remains the same, it "jerks" each second.
I don't have this problem when I use the Servo(X).angle() function.
Do you have any idea?
Re: Detailed code for the pyb.Servo library
My guess is that you are resetting the timer, instead of only changing the duty cycle. But really hard to tell without seeing the code.
Re: Detailed code for the pyb.Servo library
It was indeed the case.......Stupid mistake!
Thank you!!
Thank you!!