Hi,
There are couple of things in your code,
First: The string variable "State" is not initialized.
Second: The conditions are between range 4 and 35, so if the sensor value was beyond this range the "Stat" variable will not be used, so you will get an unused variable warning.
Have you considered this:
string Stat = "";
if (fsensorvalue1 > 4 && fsensorvalue1 < 30)
{
Stat = "Normal";
}
else if ( fsensorvalue1 > 29 && fsensorvalue1 < 35)
{
Stat = "Critical";
}
else
{
Stat = "Sensor Value '" + fsensorvalue1.ToString() + "' out of range.";
}
Regards
Jegan