I have been googling and haven't found any code to help me with this, maybe I missed something? I want to receive RS485 commands. At the moment I am just receiving rubbish. Here is my current code although I don't think it would help:
//C# CODE
byte[] arr = new byte[serialPort1.BytesToRead];
serialPort1.Read(arr, 0, serialPort1.BytesToRead);
String s = "";
foreach (byte b in arr)
{
s += b.ToString() + " ";
}
/*String s = serialPort1.ReadByte().ToString();
while (serialPort1.BytesToRead > 0)
{
s += " " + serialPort1.ReadByte().ToString();
Thread.Sleep(10);
}*/
//String s = serialPort1.ReadLine().ToString();
richTextBox1.Invoke((MethodInvoker)delegate { richTextBox1.AppendText(s + "\n"); });
This was just a test to see if I could receive the data. Does anyone know how I can receive data through serial port and show them in a text box?