Class AnalogInputSim

java.lang.Object
org.wpilib.simulation.AnalogInputSim

public class AnalogInputSim extends Object
Class to control a simulated analog input.
  • Constructor Details

    • AnalogInputSim

      public AnalogInputSim(AnalogInput analogInput)
      Constructs from an AnalogInput object.
      Parameters:
      analogInput - AnalogInput to simulate
    • AnalogInputSim

      public AnalogInputSim(int channel)
      Constructs from an analog input channel number.
      Parameters:
      channel - Channel number
  • Method Details

    • registerInitializedCallback

      public CallbackStore registerInitializedCallback(NotifyCallback callback, boolean initialNotify)
      Register a callback on whether the analog input is initialized.
      Parameters:
      callback - the callback that will be called whenever the analog input is initialized
      initialNotify - if true, the callback will be run on the initial value
      Returns:
      the CallbackStore object associated with this callback.
    • getInitialized

      public boolean getInitialized()
      Check if this analog input has been initialized.
      Returns:
      true if initialized
    • setInitialized

      public void setInitialized(boolean initialized)
      Change whether this analog input has been initialized.
      Parameters:
      initialized - the new value
    • registerVoltageCallback

      public CallbackStore registerVoltageCallback(NotifyCallback callback, boolean initialNotify)
      Register a callback on the voltage.
      Parameters:
      callback - the callback that will be called whenever the voltage is changed.
      initialNotify - if true, the callback will be run on the initial value
      Returns:
      the CallbackStore object associated with this callback.
    • getVoltage

      public double getVoltage()
      Get the voltage.
      Returns:
      the voltage
    • setVoltage

      public void setVoltage(double voltage)
      Change the voltage.
      Parameters:
      voltage - the new value
    • resetData

      public void resetData()
      Reset all simulation data for this object.