//--------------------------------------------------------------------- // This is our function that read's analog inputs // public static float ReadAnalogInput(int channel) { int ljID = -1; int overVoltage = 0; float voltage = 0.0f; int result = LabJack.EAnalogIn(ref ljID, 0, channel, 0, ref overVoltage, ref voltage); if (result != 0) { ThrowErrorMessage("Error reading analog input", result); } return(voltage); }
public static float ReadAnalogInput(int channel) { #if MOCKUP return(MockUp.GetAState(0)); #elif DEBUG return(RpiGPIO.GetAState(0)); #else lock (lockobj) { var ljID = 0; var overVoltage = 0; var voltage = 0.0f; var result = LabJack.EAnalogIn(ref ljID, 0, channel, 0, ref overVoltage, ref voltage); if (result != 0) { throw new Exception("Error reading analog input"); } return(voltage); } #endif }