我正在尝试编写一个while循环,将从DAC提取的电压转换为Count,然后将该值输出为可变结果。我想在整个代码中将变量“结果”从一个对象传递到另一个对象。例如,我想将结果传递到A50m_Button。
私人无效LabjackTest_Click(对象发送者,EventArgs e) { int handle = 0;
Boolean connectedLJ = false;
try
{
//Open LabJack
LJM.OpenS("T4", "ANY", "ANY", ref handle)
connectedLJ = true;
}
catch (LJM.LJMException c)
{
showErrorMessage(c);
}
if (connectedLJ)
{
//Setup and call eReadName to read a value.
double value = 0;
double count = 0.0048828125;
double result;
string name = "AIN0";
LJM.eReadName(handle, name, ref value);
result = value / count;
}
}
private void A50m_Button_Click(object sender, EventArgs e)
{
double setLDintensity = 0.3;
if (result > 50)
laser.setLdCurrSetpoint(setLDintensity);
else
laser.setLdCurrLimit(setLDintensity = 0);
}