internal void Run() { m_output.Set(false); try { for (int i = 0; i < m_count; i++) { Thread.Sleep(m_mSec); m_output.Set(true); Thread.Sleep(m_mSec); m_output.Set(false); } } catch (ThreadInterruptedException) { } }
public bool Reset() { try { m_input.CancelInterrupts(); } catch (InvalidOperationException) { } m_output.Set(false); return(true); }
internal void Run() { DigitalOutput lead, lag; m_outputA.Set(false); m_outputB.Set(false); if (IsForward()) { lead = m_outputA; lag = m_outputB; } else { lead = m_outputB; lag = m_outputA; } try { for (int i = 0; i < m_count; i++) { lead.Set(true); Thread.Sleep(m_mSec); lag.Set(true); Thread.Sleep(m_mSec); lead.Set(false); Thread.Sleep(m_mSec); lag.Set(false); Thread.Sleep(m_mSec); } } catch (ThreadInterruptedException) { } }
/// <summary> /// Sets a value to the DigitalOutput /// </summary> /// <param name="val">value to set the controller to</param> /// <param name="sender">the caller of this method</param> protected override void set(double val, object sender) { var value = false; Sender = sender; #if USE_LOCKING lock (dout) #endif { if (Math.Abs(val - 0) <= Math.Abs(val * .00001)) { InUse = true; dout.Set(false); onValueChanged(new VirtualControlEventArgs(0, InUse)); } else { InUse = true; dout.Set(true); value = true; onValueChanged(new VirtualControlEventArgs(1, InUse)); } /*else * { * Report.Error( * $"The valid range for DigitalOutput is 0 or 1 (false or true). {sender} tried to set a value not in this range."); * throw new ArgumentOutOfRangeException(nameof(val), * $"The valid range for DigitalOutput is 0 or 1 (false or true). {sender} tried to set a value not in this range."); * }*/ } Sender = null; InUse = false; onValueChanged(new VirtualControlEventArgs(Convert.ToDouble(value), InUse)); }
public void Reset() { compressor.Stop(); fakePressureSwitch.Set(false); }
public void TestValueChanged() { using (DigitalOutput s = new DigitalOutput(0)) { s.Set(false); Assert.That(GetOutputDictionary(0).Value, Is.False); s.ValueChanged(null, null, true, NotifyFlags.NotifyLocal); Assert.That(GetOutputDictionary(0).Value, Is.True); s.ValueChanged(null, null, false, NotifyFlags.NotifyLocal); Assert.That(GetOutputDictionary(0).Value, Is.False); } }