I am reading the output of a microcontroller through the serial port to show a value on a textbox and to draw a meter accordingly. I have written the datarecieved function which works OK as it follows.
Code:
void sp_datarecieved(object sender, SerialDataReceivedEventArgs e)
{
data = sp.ReadLine();
temp = Convert.ToDouble(data);
if (data != null)