I have programmed a small form for receiving messages from a microcontroller through a serial port.
when I use readline() method in the event of clicking a button (open port), it can receive a line of messages sending from microcontroller and show it in a textbox.
But I need to receive continuously the messages without pressing any button after opening serial port until closing the port in a multi line textbox with vertical scrollbar.
I used serialPort1_DataReceived event but I don't exactly what should I write in this event function. I tested readByte() and readChar() I couldn't receive any thing.
The microcontroller is sending data character by character with a very small delay (in order of micro seconds) in between and at the end of every message, there is \n\r.
Could you guide me to solve this problem? Should I read character by character? How? Do I need to define another function/method?
maybe you can put readline() into an infinite loop.
doing this will most likely freeze your program, so i suggest you run this loop in a second thread.