Having trouble with the following segment of code. I'm getting a parameter count mismatch.
I've had to write this because of problems with multiple threads and unsafe updates.
delegate void data_INPUTDelegate(object sender, System.IO.Ports.SerialDataReceivedEventArgs e);
private void data_INPUT(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
string data = serialPort.ReadLine();
string[] tokens = data.Split(':');
if (tokens[0] == "$SENSOR")
{
if (label_sensorValue.InvokeRequired)
{
data_INPUTDelegate del = new data_INPUTDelegate(data_INPUT);
label_sensorValue.Invoke(del,new object[] {tokens[1]});
}
else
{
label_sensorValue.Text = tokens[1];
}
}
}