K
K
kolenchits862017-02-19 12:39:24
Arduino
kolenchits86, 2017-02-19 12:39:24

How to force the application to receive-send data to the com port in arduino?

There is a virtual port on which the arduino receives and sends data.
there were no problems with getting arduino data from the application

public void SendData(string text)
        {
            if (port.IsOpen)
            {
                port.WriteLine(text);
            }
        }
private void button2_Click(object sender, EventArgs e)
        {
            port.Open();
            SendData("StartTimer");
            port.Close();
        }

but the arduina also receives signals from the buttons in real time and generates messages for the application and writes them to the port.
What I just didn’t do, but the application refuses to accept data, as if they don’t exist at all
, tell me on the topic, otherwise there are a million links, but I can’t find an answer

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sumor, 2017-02-19
@Sumor

Port closed - no data. when the port is open, the data accumulates in the receive buffer until you read it through Read or ReadLine.
It's a pity there are no options for your reading, there would be more sense.
Well, the most likely reason is that you are reading from Windows using the ReadLine method, which waits for the end of the line in the form 0x0d0a, and writing arduino, which most likely sends one character 0x0d.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question