public class SuperProSensor extends I2CSensor
| Constructor and Description |
|---|
SuperProSensor()
Creates a sensor instance connected to port S1.
|
SuperProSensor(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 analog input of the sensor.
|
void |
readDigital(int[] din)
Reads the sensor.
|
void |
setAnalogOut0(int mode,
int frequency,
int voltage)
Enables the digital output at port O0.
|
void |
setAnalogOut1(int mode,
int frequency,
int voltage)
Enables the digital output at port O1.
|
void |
setDCOut0(int frequency,
int voltage)
Same as setAnalogOut0(type, frequency, voltage) with type = 0.
|
void |
setDCOut1(int frequency,
int voltage)
Same as setAnalogOut1(type, frequency, voltage) with type = 9.
|
void |
setDIO(int[] ioControl)
Sets the direction of the 8 digital input/output channels.
|
void |
setDIOMask(int mask)
Sets the direction of the 8 digital input/output channels.
|
void |
setLED(int ledControl)
Turn the given onboard LED on.
|
void |
setNegSawtoothOut0(int frequency,
int voltage)
Same as setAnalogOut0(type, frequency, voltage) with type = 4.
|
void |
setNegSawtoothOut1(int frequency,
int voltage)
Same as setAnalogOut1(type, frequency, voltage) with type = 4.
|
void |
setPosSawtoothOut0(int frequency,
int voltage)
Same as setAnalogOut0(type, frequency, voltage) with type = 3.
|
void |
setPosSawtoothOut1(int frequency,
int voltage)
Same as setAnalogOut1(type, frequency, voltage) with type = 3.
|
void |
setPWMOut0(int frequency,
int duty)
Same as setAnalogOut0(type, frequency, voltage) with type = 6.
|
void |
setPWMOut1(int frequency,
int duty)
Same as setAnalogOut1(type, frequency, voltage) with type = 6.
|
void |
setSineOut0(int frequency,
int voltage)
Same as setAnalogOut0(type, frequency, voltage) with type = 1.
|
void |
setSineOut1(int frequency,
int voltage)
Same as setAnalogOut1(type, frequency, voltage) with type = 1.
|
void |
setSquareOut0(int frequency,
int voltage)
Same as setAnalogOut0(type, frequency, voltage) with type = 2.
|
void |
setSquareOut1(int frequency,
int voltage)
Same as setAnalogOut1(type, frequency, voltage) with type = 2.
|
void |
setTriangleOut0(int frequency,
int voltage)
Same as setAnalogOut0(type, frequency, voltage) with type = 5.
|
void |
setTriangleOut1(int frequency,
int voltage)
Same as setAnalogOut1(type, frequency, voltage) with type = 5.
|
void |
write(int[] dout)
Writes the given bit state (low/high) to the digital output channels.
|
void |
writeByte(int value)
Writes the lower byte of the given int value to the digital output channels.
|
void |
writeStrobe(int[] sout)
Writes the given bit state (low/high) to the strobe output channels.
|
void |
writeStrobeByte(int value)
Writes the lower half byte (lower 4 bits) of the given value to the strobe output channels.
|
getData, getData, getLejosI2CSensor, getProductID, getVersion, sendData, sendData, sendDatagetLejosPortpublic SuperProSensor(SensorPort port)
port - the port where the sensor is plugged-inpublic SuperProSensor()
public void setDIO(int[] ioControl)
ioControl - the direction of each channel. 0: input, 1: output
(default: all digital channels as input)public void setDIOMask(int mask)
mask - the bit maskpublic void readAnalog(int[] ain)
ain - an integer array of length 4 where to get the analog valuespublic void readDigital(int[] din)
din - an integer array of length 8 where to get the valuespublic void read(int[] ain,
int[] din)
ain - an integer array of length 4 where to get the analog valuesdin - an integer array of length 8 where to get the digital valuespublic void writeByte(int value)
value - the lower 8 bits are written to the digital output channel.public void write(int[] dout)
dout - an integer array of length 8 that holds the bit state: 0->low, 1->highpublic void writeStrobeByte(int value)
value - the lower 4 bits are written to the strobe output channel.public void writeStrobe(int[] sout)
sout - an integer array of length 4 that holds the bit state: 0->low, 1->highpublic void setLED(int ledControl)
ledControl - 0..3public void setAnalogOut0(int mode,
int frequency,
int voltage)
mode - the mode (0..6)frequency - the frequency in Hertz (1..8191)voltage - the peak-to-peak voltage (0..1021 corresponding to 0..3.3 V
centered at 1.65 V). For PWM mode the output voltage is fixed to 3.3 V and
the voltage parameter defines the duty cycle r = voltage / frequencypublic void setDCOut0(int frequency,
int voltage)
frequency - the frequency in Hertz (1..8191)voltage - the peak-to-peak voltage (0..1021 corresponding to 0..3.3 V
centered at 1.65 V)public void setSineOut0(int frequency,
int voltage)
frequency - the frequency in Hertz (1..8191)voltage - the peak-to-peak voltage (0..1021 corresponding to 0..3.3 V
centered at 1.65 V)public void setSquareOut0(int frequency,
int voltage)
frequency - the frequency in Hertz (1..8191)voltage - the peak-to-peak voltage (0..1021 corresponding to 0..3.3 V
centered at 1.65 V)public void setPosSawtoothOut0(int frequency,
int voltage)
frequency - the frequency in Hertz (1..8191)voltage - the peak-to-peak voltage (0..1021 corresponding to 0..3.3 V
centered at 1.65 V)public void setNegSawtoothOut0(int frequency,
int voltage)
frequency - the frequency in Hertz (1..8191)voltage - the peak-to-peak voltage (0..1021 corresponding to 0..3.3 V
centered at 1.65 V)public void setTriangleOut0(int frequency,
int voltage)
frequency - the frequency in Hertz (1..8191)voltage - the peak-to-peak voltage (0..1021 corresponding to 0..3.3 V
centered at 1.65 V)public void setPWMOut0(int frequency,
int duty)
frequency - the frequency in Hertz (1..8191)duty - used to set the duty cycle r = duty / frequencypublic void setAnalogOut1(int mode,
int frequency,
int voltage)
mode - the mode (0..6)frequency - the frequency in Hertz (1..8191)voltage - the peak-to-peak voltage (0..1021 corresponding to 0..3.3 V
centered at 1.65 V). For PWM mode the output voltage is fixed to 3.3 V and
the voltage parameter defines the duty cycle r = voltage / frequencypublic void setDCOut1(int frequency,
int voltage)
frequency - the frequency in Hertz (1..8191)voltage - the peak-to-peak voltage (0..1021 corresponding to 0..3.3 V
centered at 1.65 V)public void setSineOut1(int frequency,
int voltage)
frequency - the frequency in Hertz (1..8191)voltage - the peak-to-peak voltage (0..1021 corresponding to 0..3.3 V
centered at 1.65 V)public void setSquareOut1(int frequency,
int voltage)
frequency - the frequency in Hertz (1..8191)voltage - the peak-to-peak voltage (0..1021 corresponding to 0..3.3 V
centered at 1.65 V)public void setPosSawtoothOut1(int frequency,
int voltage)
frequency - the frequency in Hertz (1..8191)voltage - the peak-to-peak voltage (0..1021 corresponding to 0..3.3 V
centered at 1.65 V)public void setNegSawtoothOut1(int frequency,
int voltage)
frequency - the frequency in Hertz (1..8191)voltage - the peak-to-peak voltage (0..1021 corresponding to 0..3.3 V
centered at 1.65 V)public void setTriangleOut1(int frequency,
int voltage)
frequency - the frequency in Hertz (1..8191)voltage - the peak-to-peak voltage (0..1021 corresponding to 0..3.3 V
centered at 1.65 V)public void setPWMOut1(int frequency,
int duty)
frequency - the frequency in Hertz (1..8191)duty - used to set the duty cycle r = duty / frequency