public class SuperProSensor extends Sensor
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 |
---|---|
java.lang.String |
getProductID()
Returns the product identifier (if available).
|
java.lang.String |
getVersion()
Returns the sensor version number (if available).
|
void |
read(int[] ain,
int[] din)
Reads the sensor.
|
void |
readAnalog(int[] ain)
Reads the sensor.
|
void |
readDigital(int[] din)
Reads the sensor.
|
void |
setDCOut0(int frequency,
int voltage)
Enables the digital output at port O0 with mode 0: DC voltage level.
|
void |
setDCOut1(int frequency,
int voltage)
Enables the digital output at port O1 with mode 0: DC voltage level.
|
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)
Enables the digital output at port O0 with mode 4: Negative going sawtooth
Once the output is enabled, it remains active even when the program
terminates.
|
void |
setNegSawtoothOut1(int frequency,
int voltage)
Enables the digital output at port O1 with mode 4: Negative going sawtooth
Once the output is enabled, it remains active even when the program
terminates.
|
void |
setPosSawtoothOut0(int frequency,
int voltage)
Enables the digital output at port O0 with mode 3: Positive going sawtooth
Once the output is enabled, it remains active even when the program
terminates.
|
void |
setPosSawtoothOut1(int frequency,
int voltage)
Enables the digital output at port O1 with mode 3: Positive going sawtooth
Once the output is enabled, it remains active even when the program
terminates.
|
void |
setPWMOut0(int frequency,
int duty)
Enables the digital output at port O0 with mode 6: PWM voltage.
|
void |
setPWMOut1(int frequency,
int duty)
Enables the digital output at port O1 with mode 6: PWM voltage.
|
void |
setSineOut0(int frequency,
int voltage)
Enables the digital output at port O0 with mode 1: Sine wave.
|
void |
setSineOut1(int frequency,
int voltage)
Enables the digital output at port O1 with mode 1: Sine wave.
|
void |
setSquareOut0(int frequency,
int voltage)
Enables the digital output at port O0 with mode 2: Square wave.
|
void |
setSquareOut1(int frequency,
int voltage)
Enables the digital output at port O1 with mode 2: Square wave.
|
void |
setTriangleOut0(int frequency,
int voltage)
Enables the digital output at port O0 with mode 5: Triangle wave.
|
void |
setTriangleOut1(int frequency,
int voltage)
Enables the digital output at port O1 with mode 5: Triangle wave.
|
void |
writeByte(int value)
Writes the given byte to the digital output channels.
|
void |
writeStrobeByte(int value)
Writes the lower half byte (lower 4 bits) of the given value to the strobe output channels.
|
public SuperProSensor(SensorPort port)
port
- the port where the sensor is plugged-inpublic SuperProSensor()
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 digital 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
- a byte (lower 8 bits of int) that holds the bit state: 0->low, 1->high.
Only bit 0 to bit 7 are used.public void writeStrobeByte(int value)
value
- the lower 4 bits are written to the strobe output channel.public void setLED(int ledControl)
ledControl
- 0..3public 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.3V)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.3V)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.3V)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.3V)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.3V)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.3V)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 setDCOut1(int frequency, int voltage)
frequency
- the frequency in Hertz (1..8191)voltage
- the peak-to-peak voltage (0..1021 corresponding to 0..3.3V)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.3V)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.3V)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.3V)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.3V)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.3V)public void setPWMOut1(int frequency, int duty)
frequency
- the frequency in Hertz (1..8191)duty
- used to set the duty cycle r = duty / frequencypublic java.lang.String getProductID()
public java.lang.String getVersion()