I used an online tutorial authored by kle8309 (on YouTube) that worked nicely for sending serial data but it will not receive serial data.
I have an external micro-controller sending serial data to the computer through a serial port that i established through the USB port. When I use a terminal program (terraterm), it receives the data just fine. My C++ program though will not receive the data, it time out after the timeout that i set for it (500ms).
My external hardware is sending single byte data one byte after the next starting at "A" and going to "Z" and then looping at 9600 baud.
I tried to research what could be wrong and found this statement on MS website:
Because the SerialPort class buffers data, and the stream contained in the BaseStream property does not, the two might conflict about how many bytes are available to read. The BytesToRead property can indicate that there are bytes to read, but these bytes might not be accessible to the stream contained in the BaseStream property because they have been buffered to the SerialPort class.
I think that this statement is related to my problem but I think it was written by a lawyer :)
// check if port is ready for reading
// Reset the text in the result label.
this->textBox1->Text = "it is open!";
// this will read manually
// Disable the init button
// the asynchronous operation is done.
this->button1->Enabled = false;
// give error warning
this->textBox1->Text="Port Not Opened";
Any ideas on what I am doing wrong? For some reason, readline is not thinking that there is any data available from the serial port...