I have two Arduinos that allow serial messaging using Serial Monitor.
If I use Serial Monitor on both sides, everything works fine. If I use my C # application, nothing happens. I tried sending from Serial Monitor for a C # application and it works, but not vice versa.
comPort1.Open();
private void comPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
this.Invoke(new EventHandler(processData));
}
private void processData(object sender, EventArgs e)
{
string inData = comPort1.ReadExisting();
msgBoxLog.AppendText(inData);
}
private void sendButton_Click(object sender, EventArgs e)
{
string my_str = "my string";
msgBoxLog.AppendText(msgBox.Text + my_str);
comPort1.Write(msgBox.Text);
}
RtsEnable and DtrEnable are both included
mafap source
share