Can anyone tell me why I get a System.ArgumentException error?
Thanks.
Bernard
using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.Hardware;
namespace IO_Board_Test_PWM
{
public class Program
{
public static void Main()
{
try
{
PWM PWM_OUT1 = new PWM((PWM.Pin)USBizi.Pin.IO35);
PWM_OUT1.SetPulse(15000, 30000);
}
catch(Exception e)
{
Debug.Print("exception = " + e);
}
}
}
}
My code:
PWM PWM_OUT1 = new PWM((PWM.Pin)USBizi.Pin.IO35);
Example code:
PWM servo = new PWM((PWM.Pin)FEZ_Pin.PWM.Di5);
I have tried to use the tutorial. Evidently I have the syntax wrong. I have look extensively a the examples. All I want to know is the line of code for a USBizi pwm! I have wasted half a day on this. I am not a pro, I just need to finish a job for a customer.
Like I mentioned in my first response, use the PWM pin number instead of the io pin number. For example a pin can be IO1234 but the PWM channel is PWM2
I wrote the exact definition you needed, but you failed to test it and instead tried two other. Sorry you’re frustrated by that.
We’re here to help, and we do try - sometimes though there are things you just need to learn by doing (it wrong, and then fixing it). Hope you get your customer’s project done.
As a newbie with GHI products, I have to comment that the naming conventions are often confusing :
IO[italic]nn[/italic] of USBizi
Di[italic]nn[/italic] of various boards
Function specific pins such as PWM[italic]nn[/italic]
So I generally check 2 or 3 itmes between schematics of the Panda II , USBizi manual and GHI definitions to be sure
And I had to search for datasheet of LPC2388 to know the electrical characteristics of the pin (in/out current) as this was not listed anywhere else (at least I did not found it).
Function specific pins such as PWMnn
[/quote]
Don’t be confuse my friend, let me explain
Digital pins are always IOnn on any of our products. But then a board like Panda is made to be pinout compatible with arduino so it has its own pin definition, which goes Dinn to simplify the pin numbers. If you like to just use the IOpin numbers then you can.
Now, that was for digital IOs. For other features such as analog and PWM, you are suppose to use the channel number so if a pin is IO34/An4 then you can use this pin as digital pin with IO34 or use its analog feature as An4.