I just bought a continuous rotation servo from sparkfun, but I'm having trouble controlling it.
Here's my test code:
using System.Net; using System.Net.Sockets; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.NetduinoPlus; using Servo_API; namespace ServoTesting { public class Program { public static void Main() { // write your code here PWM servo = new PWM(Pins.GPIO_PIN_D5); servo.SetDutyCycle(0); servo.SetPulse(20000, 19000); Thread.Sleep(1000); servo.SetDutyCycle(0); Thread.Sleep(1000); servo.SetPulse(20000, 11000); Thread.Sleep(1000); servo.SetDutyCycle(0); } } }
At this point, I can only get it to rotate clockwise, and I can't figure out how to adjust the rotational velocity or change direction. in the PWM.setPulse(uint period, uint duration) method, I've tried changing both the period and duration values, but the servo's behavior changes somewhat erratically.
According to the servo's datasheet: "When analog signal inputs, servo chooses orientation according to impulse width. When intermediate value of impulse width is above 1.5ms, servo is clockwise rotation, conversely, anti-clockwise." I assume that the impulse is the durration, but in the above code, the servo rotates clockwise both times.
Thanks in advance,
selljamhere