public double ReadAmbbientTemperature() { rgbvalue = 0; MccDaq.ErrorInfo ULStat; int channel = 6; Int16 datavalue; float engunits; double TemperatureDegC = 0; double TemperatureDegF = 0; //MccDaq.ChannelType.Analog = 4; MccDaq.Range range; range = MccDaq.Range.Bip10Volts; ULStat = DaqBoard.AIn(channel, range, out datavalue); ULStat = DaqBoard.AInputMode(MccDaq.AInputMode.SingleEnded); if (ULStat.Value.Equals(MccDaq.ErrorInfo.ErrorCode.NoErrors)) { DaqBoard.ToEngUnits(range, datavalue, out engunits); TemperatureDegF = engunits * 100; // transfer function Vout = 10mV/degF //double value = 5000.0 / 1023.0; TemperatureDegC = (TemperatureDegF - 32.0) * 5.0 / 9.0; } else if (ULStat.Value.Equals(MccDaq.ErrorInfo.ErrorCode.BadRange)) { MessageBox.Show("Change the Range argument to one supported by this board.", ULStat.Message.ToString()); } else { MessageBox.Show("Some Problem has occured with the board", ULStat.Message.ToString()); } return(TemperatureDegC); }