The Netduino forums have been replaced by new forums at community.wildernesslabs.co.
This site has been preserved for archival purposes only
and the ability to make new accounts or posts has been turned off.
I have a parallax standard servo I am trying to get working with the Netduino Go Shield Base. I currently have the servo connected to 5V, GND, and analog 0.
When I turn the netduino on the servo moves just a bit but once I run the below code, nothing happens. Does anyone know why? I'm fairly new at all of this.
The servo says 0.75-2.25 ms high pulse, 20 ms intervals. So I "think" I have the constructor correct on the PWM.
ShieldBase shieldBase = new ShieldBase(GoSockets.Socket1);
PWM servo = new PWM(shieldBase.PWMChannels.PWM_0, 20, 18, PWM.ScaleFactor.Milliseconds, false);
servo.Start();
Hi QuantumPhysGuy,
If you want the PWM to be high for 2ms, you'll want to set the duration to 2ms instead of 18ms.
Also, be sure to upgrade your Shield Base to the latest firmware. There were some PWM bufixes in the newer releases.
Chris
If you want the PWM to be high for 2ms, you'll want to set the duration to 2ms instead of 18ms.
Also, be sure to upgrade your Shield Base to the latest firmware. There were some PWM bufixes in the newer releases.
Chris
Thanks Chris, I update the code to reflect your changes and I updated the Netduino GOs firmware and my shield base. Now I am having another odd issue. When the code executes it takes about 15 seconds for the POTs GO bus to turn on. The shield base is right away, the problem is, after repeated System.Exceptions in mscorlib.dll, the application just crashes...
Any ideas on this?
Here is the modified code:
private static ShieldBase shieldbase = new ShieldBase(GoSockets.Socket1);
public static void Main()
{
try
{
Potentiometer pot = new Potentiometer(GoSockets.Socket7);
PWM servo = new PWM(shieldbase.PWMChannels.PWM_0, 20, 2, PWM.ScaleFactor.Milliseconds, false);
servo.Start();
}
catch (Exception ex)
{
Debug.Print(ex.Message + "\n" + ex.StackTrace);
}
}
Stack Trace Output:
Exception was thrown: System.Exception
NetduinoGo.ShieldBase::CreatePWM
System.Reflection.MethodBase::Invoke
Microsoft.SPOT.Hardware.PWM::.ctor
Servo.Program::Main
Another odd thing, I have the servo attached to D3, 5V, and GND. It will pulse, about every 5 - 10 seconds.
Edited by QuantumPhysGuy, 01 October 2012 - 04:01 AM.
PWM servo = new PWM(shieldbase.PWMChannels.PWM_0, 20, 2, PWM.ScaleFactor.Milliseconds, false);
Hi QuantumPhysGuy,
As of the last Shield Base update the PWMChannels enums, PWM_0 to PWM_5 have been disabled. Perhaps try using the newly added enums which better reflect the actual Shield Base pins. (i.e. PWM_PIN_D5)
So try using:
PWM servo = new PWM(shieldbase.PWMChannels.PWM_PIN_D5, 20, 2, PWM.ScaleFactor.Milliseconds, false);
As of the last Shield Base update the PWMChannels enums, PWM_0 to PWM_5 have been disabled. Perhaps try using the newly added enums which better reflect the actual Shield Base pins. (i.e. PWM_PIN_D5)
So try using:
PWM servo = new PWM(shieldbase.PWMChannels.PWM_PIN_D5, 20, 2, PWM.ScaleFactor.Milliseconds, false);
I was using the incorrect version of the ShieldBase library. Thanks for pointing that out with the enumerator I didn't I have!
I ran into another odd issue last night using a Servo. I have 4 AA batteries which are supplying 6V of power. I hooked them up to my bread board and ran the VCC and GND to my servo, I have the SIG set to PIN D5 on the Netduino Go. When I sent signals to the servo nothing happened. If I wire the VCC and GND directly to the NGO it worked fine.
The servo is rated for 4V - 6V, any idea what would cause this?
I ran into another odd issue last night using a Servo. I have 4 AA batteries which are supplying 6V of power. I hooked them up to my bread board and ran the VCC and GND to my servo, I have the SIG set to PIN D5 on the Netduino Go. When I sent signals to the servo nothing happened. If I wire the VCC and GND directly to the NGO it worked fine.
The servo is rated for 4V - 6V, any idea what would cause this?
Do you have the ground for the Netduino and the negative from the batteries tied togther? You have to have a return from the signal back to the Netduino.
I ran into another odd issue last night using a Servo. I have 4 AA batteries which are supplying 6V of power. I hooked them up to my bread board and ran the VCC and GND to my servo, I have the SIG set to PIN D5 on the Netduino Go. When I sent signals to the servo nothing happened. If I wire the VCC and GND directly to the NGO it worked fine.
The servo is rated for 4V - 6V, any idea what would cause this?
Did you connect the GND on the Netduino to the GND on the breadboard?