public void Setup()
 {
     analogIO = TestBench.GetAnalogCrossConnectFixture();
     potSource = new FakePotentiometerSource(analogIO.GetOutput(), 360);
     pot = new AnalogPotentiometer(analogIO.GetInput(), 360.0, 0);
 }
Example #2
0
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="channel">The analog channel this potentiometer is plugged into.</param>
 /// <param name="commonName">CommonName the component will have</param>
 public PotentiometerItem(int channel, string commonName)
 {
     apt  = new AnalogPotentiometer(channel);
     Name = commonName;
 }
        public void TestPotentiometerCreatedWithAnalogInput()
        {
            using (AnalogInput aIn = new AnalogInput(0))
            {
                Assert.That(GetInputData(0).Initialized, Is.True);
                using (AnalogPotentiometer pot = new AnalogPotentiometer(aIn))
                {

                }
                Assert.That(GetInputData(0).Initialized, Is.True);
            }
            Assert.That(GetInputData(0).Initialized, Is.False);
        }
 public void Setup()
 {
     m_analogIo  = TestBench.GetAnalogCrossConnectFixture();
     m_potSource = new FakePotentiometerSource(m_analogIo.GetOutput(), 360);
     m_pot       = new AnalogPotentiometer(m_analogIo.GetInput(), 360.0, 0);
 }
        public void TestAnalogInputGet([Range(0.0,1.0, 0.2)] double fullRange, [Range(0.0, 1.0, 1.0)] double offset)
        {
            using (AnalogPotentiometer input = new AnalogPotentiometer(0, fullRange, offset))
            {
                GetInputData(0).Voltage = 3.0;
                // result = (get / 5v) * range + offset
                // (result - offset) / range = get /5v
                // (result - offset * 5v) / range = get
                double expected = (3.0 / ControllerPower.GetVoltage5V()) * fullRange + offset;

                Assert.AreEqual(expected, input.Get(), 0.0001);
            }
        }