I have a program that allows several Arduinos to communicate via Serial Port. For example if Arduino1 want to communicate with Arduino3 the user sends a string from Arduino1 and this string appears on Arduino3 and so on. This is working good with SerialMonitor.
The problem is when I try to do the same in my C# application (nothing appears). I tryed this:
//(...)
comPort1.Open();
//(...)
private void comPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
string inData = comPort1.ReadLine();
msgBoxLog.AppendText(inData); // msgBoxLog = textBox with data received/sent
}
//(...)
private void sendButton_Click(object sender, EventArgs e)
{
string my_str = "my string";
msgBoxLog.AppendText(my_str + "\r\n");
comPort1.WriteLine(my_str + "\r\n");
}
Some notes:
- RtsEnable and DtrEnable are both active
- BaudRate (Arduino / C#) = 1200
Is baudrate value a problem? I must use this value but I'm not sure if it is accepted by C#. I also tryed something like this but with no success.