Hello,
I use C# sample in DobotClientDemo2.0 as practice. I want to control conveyor belt and I notice there is no SetEMoter function, so I add one.
Function SetEmotor added in DobotDll.cs
[DllImport(“DobotDll.dll”, EntryPoint = “SetEMotor”, CallingConvention = CallingConvention.Cdecl)]
public static extern int SetEMotor(ref EMotor emotor, bool isQueued, ref UInt64 queuedCmdIndex);
Struct EMotor added in DobotDllType.cs
public struct EMotor {
public byte index;
public byte isEnabled;
public UInt32 speed;
}
Execute SetMotor
private int setmotor(bool isEnabled, UInt32 speed, bool isQueued)
{
EMotor emotor;
emotor.index = 0;
emotor.isEnabled = 1;
emotor.speed = speed;
UInt64 cmdIndex = 0;
int ret = DobotDll.SetEMotor(ref emotor, isQueued, ref cmdIndex);
return ret;
}
Return 0 but nothing happened.
I tried SetEMotor in DobotStudio script and it works fine.