Hi All,
Quick question to those of you who have gotten a USB Arduino board talking with a Windows console application. Can anyone spot what I'm doing wrong here? The code below works fine with my USB->Serial adapter based around the Prolific chip, but can't seem to find the port when used with my Arduino. The Arduino host software communicates fine with the board. This code, however, consistently returns ERROR_FILE_NOT_FOUND. Any thoughts?
HANDLE hSerial;
hSerial = CreateFile("COM15",
GENERIC_WRITE,
0,
0,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
0);
if (hSerial == INVALID_HANDLE_VALUE)
{
if (GetLastError() == ERROR_FILE_NOT_FOUND)
{
printf("port does not exist");
return 0;
}
printf("some other error");
return 0;
}