Click here to Skip to main content
15,868,141 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Good Day, Fellows.
The problem is that i cant gunderstand how to send data from my pc to microcontroller.
On the electronic side everything is working, PC can see my com-port.
Maybe someone has a step-by-step guide?
Any help, please.
thanks in further.

What I have tried:

I found a topic Serial Comms in C# for Beginners[^]
Is that it?
I faced a problem on a start.
Quote:
To the button's click routine I have added the following code:

private void btnGetSerialPorts_Click(object sender, EventArgs e)
{
    string[] ArrayComPortsNames = null;
    int index = -1;
    string ComPortName = null;

    ArrayComPortsNames = SerialPort.GetPortNames();
    do
    {
         index += 1;
        rtbIncoming.Text += ArrayComPortsNames[index]+"\n";
    }
    while (!((ArrayComPortsNames[index] == ComPortName) ||
                        (index == ArrayComPortsNames.GetUpperBound(0))));
}

I receive a error that
rtbIncoming.Text += ArrayComPortsNames[index] + "\n";

Where
rtbIncoming.Text

rtbIncoming
- doesnt exist in this context
Posted
Updated 25-Jan-17 21:24pm
Comments
Jochen Arndt 26-Jan-17 3:17am    
"rtbIncoming" is probably the text edit control member shown on the form.
But the article text refers to a Rich Text control "rtbIncomingData".
So you might try to use that instead. If that helps you might post a message in the article forum about this.

1 solution

As noted by Jochen, your problem has nothing to do with the serial communication. The error clearly states the rtbIncoming object does not exists in your Form. The array ArrayComPortsNames contains the sequence of serial port names, you might use it to fill the items of a listbox (or whatever).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900