/// <summary> /// The VoltageRead2 /// </summary> private void VoltageRead2() { form10 = new TP2(this); form10.ShowDialog(this); while (form10.Visible == true) { Application.DoEvents(); } if (DMM.IsOpen) { //DMM.Open(); DMM.DiscardInBuffer(); DMM.Write(":FETCh? \r"); System.Threading.Thread.Sleep(3000); string response = DMM.ReadExisting(); //read response string textBox3.Text = response; double responseD = double.Parse(response); textBox3.Text = string.Format("{0:0.000}", responseD); DMM.DiscardOutBuffer(); //this.Refresh(); DataAccess.DataTable dt = DataAccess.DataTable.New.ReadCsv(@"Voltage.csv"); // Query via the DataTable.Rows enumeration. foreach (Row row in dt.Rows) { listBox2.Items.Add(row["Voltage2"]); } if (listBox2.Items.Contains(textBox3.Text)) { led3.OffColor = Color.LimeGreen; } else { MessageBox.Show("Please check the DMM USB connections"); led3.OffColor = Color.Red; } } else { MessageBox.Show("Please check the DMM USB connections"); led3.OffColor = Color.Red; } this.Refresh(); }
/// <summary> /// The CurrentRead /// </summary> private void CurrentRead() { if (DMM.IsOpen) { // DMM.Open(); // DMM.DiscardInBuffer(); DMM.Write("FETCh?\r"); System.Threading.Thread.Sleep(3000); // DMM.Write(":FETCh? \r"); string response = DMM.ReadExisting(); //read response string //System.Threading.Thread.Sleep(3000); textBox1.Text = response; /* decimal responseD = decimal.Parse(response); * textBox1.Text = String.Format("{0:n4}", responseD);*/ DMM.DiscardOutBuffer(); // this.Refresh(); DataAccess.DataTable dt = DataAccess.DataTable.New.ReadCsv(@"Voltage.csv"); // Query via the DataTable.Rows enumeration. foreach (Row row in dt.Rows) { listBox5.Items.Add(row["Current"]); } if (listBox5.Items.Contains(textBox1.Text)) { led1.OffColor = Color.LimeGreen; } else { MessageBox.Show("Please check the DMM USB connections"); led1.OffColor = Color.Red; } } else { MessageBox.Show("Please check the DMM USB connections"); led1.OffColor = Color.Red; } this.Refresh(); }
/// <summary> /// The VoltageSwitch /// </summary> private void VoltageSwitch() { if (DMM.IsOpen) { //DMM.Open(); DMM.Write("FUNC VOLT:DC \r"); System.Threading.Thread.Sleep(1000); DMM.DiscardOutBuffer(); } else { MessageBox.Show("Check the DMM Connections"); led2.OffColor = Color.Red; } this.Refresh(); }
/// <summary> /// The CurrentSwitch /// </summary> private void CurrentSwitch() { if (!DMM.IsOpen) { DMM.Open(); DMM.Write("FUNC CURR:DC \r"); System.Threading.Thread.Sleep(3000); DMM.Write("FUNC CURR:DC \r"); DMM.DiscardOutBuffer(); } else { MessageBox.Show("Check the DMM Connections"); led1.OffColor = Color.Red; } this.Refresh(); }
// start from unity3d public void Start() { dmm = face.GetComponent <DMM>(); init(); }
// Use this for initialization void Start() { dMAn2 = FindObjectOfType <DMM>(); }