Hi all, spent a few hours this weekend banging my head against a wall trying to make a servo work on a hydra. Finally broke down and pulled out the o’scope and saw that it was generating pulses at nearly random rates…
Tried this code on a spider, works as expected.
Updated firmware just to make sure it is up to date and still no luck.
TinyBooter Version: 4.1.3.1
Firmware Version: 4.1.3.1
using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;
using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;
using GTI = Gadgeteer.Interfaces;
namespace ServoTest
{
public partial class Program
{
uint HighTime = 100000;
uint ServoRate = 20 * 1000 * 1000;
GTI.PWMOutput Servo;
void ProgramStarted()
{
button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
button1.ButtonPressed += new Button.ButtonEventHandler(button1_ButtonPressed);
Servo = extender.SetupPWMOutput(GT.Socket.Pin.Nine);
}
void button1_ButtonPressed(Button sender, Button.ButtonState state)
{
ServoRate += 1000000;
Servo.SetPulse(ServoRate, HighTime);
Debug.Print("Rate set to:" + ServoRate.ToString());
}
void button_ButtonPressed(Button sender, Button.ButtonState state)
{
ServoRate -= 1000000;
Servo.SetPulse(ServoRate, HighTime);
Debug.Print("Rate set to:" + ServoRate.ToString());
}
}
}
I also did a quick search on the forums… stopped after 8 pages with no luck.
Do I just have a bad Hydra?