public class PrototypeSensor extends I2CSensor
Constructor and Description |
---|
PrototypeSensor()
Creates a sensor instance connected to port S1.
|
PrototypeSensor(SensorPort port)
Creates a sensor instance connected to the given port.
|
Modifier and Type | Method and Description |
---|---|
void |
read(int[] ain,
int[] din)
Reads the sensor.
|
void |
readAnalog(int[] ain)
Reads the sensor.
|
void |
readDigital(int[] din)
Reads the sensor.
|
void |
setDIO(int[] ioControl)
Sets the direction of the 6 digital input/output channels.
|
void |
setDIOMask(int mask)
Sets the direction of the 6 digital input/output channels.
|
void |
setSamplingPeriod(int period)
Sets the sampling period of the ADC (4..100 ms, default 4 ms).
|
void |
write(int[] dout)
Writes the given bit state (low/high) to the digital output channels.
|
void |
writeByte(int value)
Writes the given byte to the digital output channels.
|
getData, getData, getLejosI2CSensor, getProductID, getVersion, sendData, sendData, sendData
getLejosPort
public PrototypeSensor(SensorPort port)
port
- the port where the sensor is plugged-inpublic PrototypeSensor()
public void setDIO(int[] ioControl)
ioControl
- the direction of each channel. 0: input, 1: outputpublic void setDIOMask(int mask)
mask
- the bit maskpublic void readAnalog(int[] ain)
ain
- an integer array of length 5 where to get the analog valuespublic void readDigital(int[] din)
din
- an integer array of length 6 where to get the digital valuespublic void read(int[] ain, int[] din)
ain
- an integer array of length 5 where to get the analog valuesdin
- an integer array of length 6 where to get the digital valuespublic void write(int[] dout)
dout
- an integer array of length 6 that holds the bit state: 0->low, 1->highpublic void writeByte(int value)
value
- a byte (lower 8 bits of int) that holds the bit state: 0->low, 1->high.
Only bit 0 to bit 5 are used.public void setSamplingPeriod(int period)
period
- the new sampling period