Пример #1
0
        public void TestPressureSwitch()
        {
            double range = 0.1;

            Reset();
            compressor.ClosedLoopControl = true;

            fakePressureSwitch.Set(true);
            Timer.Delay(CompressorDelayTime);

            Assert.That(fakeCompressor.GetVoltage(), Is.EqualTo(CompressorOffVoltage).Within(range));

            fakePressureSwitch.Set(false);

            Assert.That(fakeCompressor.GetVoltage(), Is.EqualTo(CompressorOnVoltage).Within(range));
        }
Пример #2
0
        /// <summary>
        ///     Gets the input voltage from the AnalogInput
        /// </summary>
        /// <returns>Double</returns>
        public override double Get()
        {
#if USE_LOCKING
            lock (ain)
#endif
            {
                var voltage = ain.GetVoltage();

                if (Math.Abs(previousVoltage - voltage) <= Math.Abs(previousVoltage * .00001))
                {
                    onValueChanged(new VirtualControlEventArgs(voltage, InUse));
                }

                previousVoltage = voltage;
                return(previousVoltage);
            }
        }
Пример #3
0
 public void Update()
 {
     SmartDashboard.PutNumber("Analog Pressure Voltage", Pressure.GetVoltage());
     SmartDashboard.PutNumber("~Pressure (PSI)", AnalogToUnitPSI(Pressure.GetVoltage()));
 }