I have read through the data sheet but it didn't help much, it seems more directed to the electrical side of things, and I couldn't get the SimpleIo example to work, I simply want to write 1 byte to my device:
DeviceId = 40;
Address = 1;
Data = 0 - 255;
i have been using the following code:
Code: Select all
for(int i = 0; i < 255; i++)
{
Write(ioHandle,40,1,i);
cout << i << endl;
Sleep(20);
}
Code: Select all
void Write(IOWKIT_HANDLE ioHandle, int deviceId, int address, byte data)
{
IOWKIT_SPECIAL_REPORT report;
memset(&report, 0, IOWKIT_SPECIAL_REPORT_SIZE);
report.ReportID = 0x02;
report.Bytes[0] = 0xc1 + 1;
report.Bytes[1] = deviceId << 1;
report.Bytes[2] = data;
//report.Bytes[3] = address;
ULONG rc=IowKitWrite(ioHandle, IOW_PIPE_SPECIAL_MODE, (char*)&report, IOWKIT_SPECIAL_REPORT_SIZE);
}
i know it isn't correct but I am getting some sort of output with it, it should make my light source fade on as data increases from 0 to 255 but instead the light alternates on and off every 8 bytes. when the fourth bit is 0 the light is off and when it is 1 the light is fully on.
0000 0000 - light off
0000 0001 - light off
0000 0010 - light off
0000 0011 - light off
0000 0100 - light off
0000 0101 - light off
0000 0110 - light off
0000 0111 - light off
0000 1000 - light on
0000 1001 - light on
0000 1010 - light on
0000 1011 - light on
0000 1100 - light on
0000 1101 - light on
0000 1110 - light on
0000 1111 - light on
0001 0000 - light off
....