Class WsContinuousI2CInput

  • Direct Known Subclasses:
    WsLidarSensor

    public class WsContinuousI2CInput
    extends WsI2CInput
    Contiunously reads a sensor using I2C.
    • Field Detail

      • currentValue

        protected byte[] currentValue
    • Constructor Detail

      • WsContinuousI2CInput

        public WsContinuousI2CInput​(java.lang.String name,
                                    edu.wpi.first.wpilibj.I2C.Port port,
                                    int address,
                                    int updateInterval)
        Construct the hall effect sensor.
        Parameters:
        name - Descriptive name of the sensor.
        port - Hardware port number the sensor is connected to.
        address - I2C address of the sensor.
        updateInterval - Number of milliseconds between updates.
    • Method Detail

      • readRawValue

        protected byte[] readRawValue()
        Reads the value from the sensor.
        Overrides:
        readRawValue in class WsI2CInput
        Returns:
        Raw value from the sensor.
      • getIntValue

        public int getIntValue()
        Returns a single integer value.
        Returns:
        Int representation of latest sensor reading.
      • start

        public void start​(int period)
        Begin polling the sensor.
        Parameters:
        period - Time in milliseconds between successive updates.
      • stop

        public void stop()
        Stops sensor polling.