I'm trying to control a LEGO servo (88004) using a Raspberry pi. I would like to use pigpio to get a more precise control (no shaking, like with gpio PWM).
It's work with a regular servo (3 wires). It kinda works with the 88004, it buzz when I test it (both with c1 and c2), but I can't make it move :-( (see code below).
Anyone have a suggestions to this problem?
"Kinda" working python code.
import time
import pigpio
pi = pigpio.pi()
if not pi.connected:
exit()
#sudo pigpiod -s8
c1 = 23
c2 = 24
pi.set_PWM_frequency(c1,1250)
pi.set_PWM_frequency(c2,1250)
print(pi.get_PWM_frequency(c1))
#use NAME (GPIO02 = 2)
while True:
pi.set_servo_pulsewidth(c1, 0)
pi.set_servo_pulsewidth(c2, 0)
print "reset"
try:
pi.set_servo_pulsewidth(c1,2000)
pi.set_servo_pulsewidth(c2,2500)
print "c1"
time.sleep(3)
pi.set_servo_pulsewidth(c1,0)
pi.set_servo_pulsewidth(c2,2500)
print "c2"
time.sleep(3)
except KeyboardInterrupt:
break
print("\nTidying up")
pi.set_servo_pulsewidth(c1, 0)
pi.set_servo_pulsewidth(c2, 0)
pi.stop()