public class RCXRotationSensor extends AnalogSensor implements Tachometer, SensorConstants
Modifier and Type | Class and Description |
---|---|
protected class |
RCXRotationSensor.Reader |
Modifier and Type | Field and Description |
---|---|
protected int |
count |
protected static int[][] |
inc
The following table when indexed by [previous phase][current phase]
provides the current direction of rotation.
|
static int |
ONE_ROTATION
The incremental count for one whole rotation (360 degrees).
|
protected RCXRotationSensor.Reader |
reader |
protected static int |
UPDATE_TIME |
currentType, port
currentMode, modes
BLACK, BLANK_INDEX, BLUE, BLUE_INDEX, BROWN, GREEN, GREEN_INDEX, MAX_TYPE, MIN_TYPE, MODE_RAW, NXT_ADC_RES, RED, RED_INDEX, TYPE_ANGLE, TYPE_COLORBLUE, TYPE_COLORFULL, TYPE_COLORGREEN, TYPE_COLORNONE, TYPE_COLORRED, TYPE_CUSTOM, TYPE_HIGHSPEED, TYPE_HIGHSPEED_9V, TYPE_HISPEED, TYPE_LIGHT_ACTIVE, TYPE_LIGHT_INACTIVE, TYPE_LOWSPEED, TYPE_LOWSPEED_9V, TYPE_NO_SENSOR, TYPE_REFLECTION, TYPE_SOUND_DB, TYPE_SOUND_DBA, TYPE_SWITCH, TYPE_TEMPERATURE, WHITE, YELLOW
Constructor and Description |
---|
RCXRotationSensor(Port p)
Create an RCX rotation sensor object attached to the specified port.
|
Modifier and Type | Method and Description |
---|---|
protected int |
getPhase()
Returns the current phase of the sensor.
|
int |
getRawTachoCount()
Returns the raw values from the rotation sensor instead of degrees.
|
int |
getRotationSpeed()
Returns the actual speed.
|
int |
getTachoCount()
Returns the tachometer count.
|
void |
resetTachoCount()
Reset the tacho count to zero.
|
normalize, NXTRawIntValue, NXTRawValue, switchType
fetchSample, getAvailableModes, getCurrentMode, getMode, getMode, getModeCount, getName, sampleSize, setCurrentMode, setCurrentMode, setModes
close, releaseOnClose
public static final int ONE_ROTATION
protected static final int UPDATE_TIME
protected int count
protected final RCXRotationSensor.Reader reader
protected static final int[][] inc
public RCXRotationSensor(Port p)
p
- port, e.g. Port.S1protected int getPhase()
public int getTachoCount()
getTachoCount
in interface Encoder
public int getRawTachoCount()
public void resetTachoCount()
resetTachoCount
in interface Encoder
public int getRotationSpeed()
Tachometer
getRotationSpeed
in interface Tachometer