Example #1
0
        /// <summary>
        ///     Sets a value to the AnalogInput
        /// </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)
        {
            Sender = sender;
#if USE_LOCKING
            lock (aout)
#endif
            {
                if (val >= 0 && val <= 5)
                {
                    InUse = true;
                    aout.SetVoltage(val);
                    onValueChanged(new VirtualControlEventArgs(val, InUse));
                }
                else
                {
                    Report.Error(
                        $"The valid range for AnalogOutput is 0 to 5. {sender} tried to set a value not in this range.");
                    throw new ArgumentOutOfRangeException(nameof(val),
                                                          $"The valid range for AnalogOutput is 0 to 5. {sender} tried to set a value not in this range.");
                }
            }

            Sender = null;
            InUse  = false;
            onValueChanged(new VirtualControlEventArgs(val, InUse));
        }
 public bool Setup()
 {
     Initialize();
     m_output.SetVoltage(0);
     return(true);
 }
 public void Reset()
 {
     m_potMaxAngle = m_defaultPotMaxAngle;
     m_output.SetVoltage(0.0);
 }