Hi all,
I recently picked up a small servo for testing with my Spider mainboard, and I’m now trying to make this work, with no luck unfortunately.
I have the servo hooked up via breadboard, using the Extender module as a breakout. The positive wire on the servo is hooked to the 5v terminal on the Extender, the negative to GND, and the white (control) wire is connected to pin 9, which I have configured as a PWMOutput. Here’s the basic code:
static GT.Interfaces.PWMOutput servo;
static Font font = Resources.GetFont(Resources.FontResources.NinaB);
void ProgramStarted()
{
display.SimpleGraphics.BackgroundColor = GT.Color.LightGray;
display.SimpleGraphics.DisplayTextInRectangle("Program running...", 2, 2, 150, 30, GT.Color.Red, font);
servo = extender.SetupPWMOutput(GT.Socket.Pin.Nine);
button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
}
void button_ButtonPressed(Button sender, Button.ButtonState state)
{
display.SimpleGraphics.DisplayRectangle(GT.Color.LightGray, 0, GT.Color.LightGray, 2, 35, 150, 30);
display.SimpleGraphics.DisplayTextInRectangle("Setting servo pulse...", 2, 35, 150, 30, GT.Color.Red, font);
servo.SetPulse(20000000, 2250 * 1000);
}
The servo specifies a control voltage between 3.3-5v, with a .75-2.25 ms high pulse, and 20ms intervals. When the program calls the line servo.SetPulse, the board resets (this appears similar to the symptom I’m seeing in this thread: [url]http://www.tinyclr.com/forum/21/5121/[/url]).
I’ve tried running it both with and without external power, and regardless of how the board is powered, the board resets when I call SetPulse, and the servo does not move (I’ve tried using different pulse settings within the stated range to no effect).
Any suggestions?