public void TestAnalogTriggerBelowWindow() { AnalogTrigger trigger = new AnalogTrigger(s_analogIo.GetInput()); trigger.SetLimitsVoltage(2.0f, 3.0f); s_analogIo.GetOutput().SetVoltage(1.0f); Timer.Delay(DelayTime); Assert.IsFalse(trigger.GetInWindow(), "Analog Trigger is in the window (2V, 3V)"); Assert.IsFalse(trigger.GetTriggerState(), "Analog trigger is on"); trigger.Dispose(); }
public void TestAnalogTriggerInWindow() { AnalogTrigger trigger = new AnalogTrigger(s_analogIo.GetInput()); trigger.SetLimitsVoltage(2.0f, 3.0f); s_analogIo.GetOutput().SetVoltage(2.5f); Timer.Delay(DelayTime); Assert.IsTrue(trigger.GetInWindow(), "Analog Trigger is not in the window (2V, 3V)"); //Not checking for state, because state will be whichever state it was in last. trigger.Dispose(); }
public void TestAnalogTriggerInWindow() { AnalogTrigger trigger = new AnalogTrigger(analogIO.GetInput()); trigger.SetLimitsVoltage(2.0f, 3.0f); analogIO.GetOutput().SetVoltage(2.5f); Timer.Delay(DelayTime); Assert.IsTrue(trigger.InWindow, "Analog Trigger is not in the window (2V, 3V)"); Assert.IsFalse(trigger.TriggerState, "Analog trigger is on"); trigger.Dispose(); }
public void TestAnalogTriggerCounter() { AnalogTrigger trigger = new AnalogTrigger(s_analogIo.GetInput()); trigger.SetLimitsVoltage(2.0f, 3.0f); Counter counter = new Counter(trigger); for (int i = 0; i < 50; i++) { s_analogIo.GetOutput().SetVoltage(1.0); Timer.Delay(DelayTime); s_analogIo.GetOutput().SetVoltage(4.0); Timer.Delay(DelayTime); } Assert.AreEqual(50, counter.Get(), "Analog trigger counter did not count 50 ticks"); counter.Dispose(); trigger.Dispose(); }