Class AnalogInputSim

java.lang.Object
edu.wpi.first.wpilibj.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
    • registerAverageBitsCallback

      public CallbackStore registerAverageBitsCallback(NotifyCallback callback, boolean initialNotify)
      Register a callback on the number of average bits.
      Parameters:
      callback - the callback that will be called whenever the number of average bits is changed
      initialNotify - if true, the callback will be run on the initial value
      Returns:
      the CallbackStore object associated with this callback.
    • getAverageBits

      public int getAverageBits()
      Get the number of average bits.
      Returns:
      the number of average bits
    • setAverageBits

      public void setAverageBits(int averageBits)
      Change the number of average bits.
      Parameters:
      averageBits - the new value
    • registerOversampleBitsCallback

      public CallbackStore registerOversampleBitsCallback(NotifyCallback callback, boolean initialNotify)
      Register a callback on the amount of oversampling bits.
      Parameters:
      callback - the callback that will be called whenever the oversampling bits are changed.
      initialNotify - if true, the callback will be run on the initial value
      Returns:
      the CallbackStore object associated with this callback.
    • getOversampleBits

      public int getOversampleBits()
      Get the amount of oversampling bits.
      Returns:
      the amount of oversampling bits
    • setOversampleBits

      public void setOversampleBits(int oversampleBits)
      Change the amount of oversampling bits.
      Parameters:
      oversampleBits - 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.