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
Contiunously reads a sensor using I2C.
-
Field Summary
FieldsFields inherited from class org.wildstang.hardware.roborio.inputs.WsI2CInput
i2c -
Constructor Summary
ConstructorsConstructorDescriptionWsContinuousI2CInput(String name, edu.wpi.first.wpilibj.I2C.Port port, int address, int updateInterval) Construct the hall effect sensor. -
Method Summary
Methods inherited from class org.wildstang.framework.io.inputs.I2CInput
getValue, readDataFromInput, setValueMethods inherited from class org.wildstang.framework.io.inputs.Input
addInputListener, disable, enable, getInputListeners, getName, hasValueChanged, isEnabled, notifyListeners, removeAllListeners, removeInputListener, setValueChanged, update
-
Field Details
-
currentValue
protected byte[] currentValue
-
-
Constructor Details
-
WsContinuousI2CInput
public WsContinuousI2CInput(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 Details
-
readRawValue
protected byte[] readRawValue()Reads the value from the sensor.- Overrides:
readRawValuein 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.
-