|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread lejos.nxt.addon.RCXRotationSensor
public class RCXRotationSensor
Provide access to the Lego RCX Rotation Sensor. The sensor records the direction and degree of rotation. A full rotation will result in a count of +/-16. Thus each count is 22.5 degrees.
Nested Class Summary | |
---|---|
protected class |
RCXRotationSensor.Reader
|
Field Summary | |
---|---|
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 LegacySensorPort |
port
|
protected RCXRotationSensor.Reader |
reader
|
protected static int |
UPDATE_TIME
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
RCXRotationSensor(LegacySensorPort port)
Create an RCX rotation sensor object attached to the specified port. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Thread |
---|
currentThread, getName, getPriority, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, run, setDaemon, setName, setPriority, sleep, start, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int ONE_ROTATION
protected static final int UPDATE_TIME
protected LegacySensorPort port
protected int count
protected final RCXRotationSensor.Reader reader
protected static final int[][] inc
Constructor Detail |
---|
public RCXRotationSensor(LegacySensorPort port)
port
- port, e.g. Port.S1Method Detail |
---|
protected 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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |