I developed a program on Win7 that reads data from the Arduino USB/COM port using ReadFile.
With all the non UNO Arduino's whenever the USB is disconnected from the Win7 PC ReadFile returns an error and I then close the handle. The Win7 C++ code then starts a for loop looking for the Arduino USB/COM port to be plugged back into the machine.
Unfortunately, with the UNO ReadFile never returns an error if the UNO USB is unplugged from the computer. So my program is now stuck in a loop trying to read data from a port that isn't there any more.
ReadFile() returns ERROR_OPERATION_ABORTED when the USB is unplugged on any non UNO Arduino.
ReadFile() never returns ever when a UNO is unplugged.
Any ideas?
Serial.h (1.34 KB)
serialtest.cpp (4.55 KB)