Hello,
I'm new to embedded programming but not to .net.
I have a Netduino plus 2 board and I'm going through the tutorials in Chris Walker's intro book but all the examples with PWM objects are failing. Am I looking in the wrong namespace? My only guess is that the constructor has changed since the book was written and now it requires additional parameters.
I've looked at the documentation on MSDN
When I try to plug in the other parameters then I get a bug about the
"Pins.GPIO_PIN_D5" being incorrect, Instead it says I should be using the enum: Microsoft.SPOT.Hardware.Cpu.PWMChannel.
As an example I posted one of the samples from the book below:
Any help would be greatly appreciated!
public static void Main()
{
// write your code here
PWM servo = new PWM(Pins.GPIO_PIN_D5);
uint firstPosition = 1000;
uint lastPosition = 2000;
// move through the full range of positions
for (uint currentPosition = firstPosition;
currentPosition <= lastPosition;
currentPosition += 10)
{
// move the servo to the new position.
servo.SetPulse(20000, currentPosition);
Thread.Sleep(10);
}
// return to first position and wait a half second.
servo.SetPulse(20000, firstPosition);
Thread.Sleep(Timeout.Infinite);
}
I am getting the following errors:
'Microsoft.SPOT.Hardware.PWM' does not contain a constructor that takes 1 arguments
'Microsoft.SPOT.Hardware.PWM' does not contain a definition for 'SetPulse' and no extension method 'SetPulse' accepting a first argument of type 'Microsoft.SPOT.Hardware.PWM' could be found (are you missing a using directive or an assembly reference?)