SetIOPWM in C# does not work


#1

Hi,

Using the C# wrapper, the call to SetIOPWM does not work.

Examining the serial trace, I can see that the frequency and dutycycle values are mangled in the command sent to the Dobot.

this is the serial trace

[11/07/2017 13:01:49] Written data (COM17)
aa aa 0b 84 03 0b 00 00 00 00 00 80 3f 00 af ªª.„…€?.¯
[11/07/2017 13:01:49] Read data (COM17)
aa aa 0a 84 03 88 00 00 00 00 00 00 00 f1 ªª.„.ˆ…ñ

produced by the following code:

IOPWM ioPwm = new IOPWM();

ioPwm.address = 11;
ioPwm.frequency = 50;
ioPwm.dutyCycle = 4;
reference = 0;

result = DobotDll.SetIOPWM(ref ioPwm, true, ref reference);
Console.WriteLine(string.Format(“SetIOPWM = [{0}], {1}-{2}”, result, ioPwm.frequency, ioPwm.dutyCycle));

if (result != 0)
{
throw new Exception(“set cmd failed”);
}

Cheers,

Gerry


#2

Did you find a solution for your problem?