Today I managed to use a little sevo with my Raspberry Pi (RPi).
There are different ways to do this but, in my opinion, python is too slow and you will need a fast pwm in order to properly drive the servos. I found this project which is written in C and looks fast enough. Let’s see how to use it.
Get a shell on your RPi and type:
wget http://abyz.co.uk/rpi/pigpio/pigpio.tar tar -xvf pigpio.tar cd pigpio cp libpigpio.a-hard libpigpio.a make sudo make install sudo pigpiod
I wrote a script in python to use the c library:
from subprocess import call for pos in range(530,2300): call(["pigs","S","18",pos ]) #S is for servo, 18 is the gpio and pos is the position print "position:"+str(pos)