In my app I am sending data to microcontroller. I send data, microcontroller do program, and send character ("K"). My application should wait for this character.After receiving this char, it should send data again.
I got problem with receiving this character. Is function BytesToRead right to reading character? My program always fall when it reach this my function wait
static void wait()
{
SerialPort COMport = new SerialPort();
int znak;
COMport.PortName = "COM6"; //
COMport.BaudRate = 1200;
COMport.DataBits = 8;
COMport.Parity = Parity.None;
COMport.StopBits = StopBits.One;
COMport.Open();
do
{
znak = COMport.BytesToRead;
} while (znak != 75); // ASCII K = 75
COMport.Close();
return;
}