Class WsContinuousI2CInput
- java.lang.Object
-
- org.wildstang.framework.io.inputs.Input
-
- org.wildstang.framework.io.inputs.I2CInput
-
- org.wildstang.hardware.roborio.inputs.WsI2CInput
-
- org.wildstang.hardware.roborio.inputs.WsContinuousI2CInput
-
- Direct Known Subclasses:
WsLidarSensor
public class WsContinuousI2CInput extends WsI2CInput
Contiunously reads a sensor using I2C.
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]
currentValue
-
Fields inherited from class org.wildstang.hardware.roborio.inputs.WsI2CInput
i2c
-
-
Constructor Summary
Constructors Constructor Description WsContinuousI2CInput(java.lang.String name, edu.wpi.first.wpilibj.I2C.Port port, int address, int updateInterval)
Construct the hall effect sensor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getIntValue()
Returns a single integer value.protected byte[]
readRawValue()
Reads the value from the sensor.void
start(int period)
Begin polling the sensor.void
stop()
Stops sensor polling.-
Methods inherited from class org.wildstang.framework.io.inputs.I2CInput
getValue, readDataFromInput, setValue
-
Methods inherited from class org.wildstang.framework.io.inputs.Input
addInputListener, disable, enable, getInputListeners, getName, hasValueChanged, isEnabled, notifyListeners, removeAllListeners, removeInputListener, setValueChanged, update
-
-
-
-
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 classWsI2CInput
- 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.
-
-