|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.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
|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| 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 |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, 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.S1| Method Detail |
|---|
protected int getPhase()
public int getTachoCount()
getTachoCount in interface Encoderpublic int getRawTachoCount()
public void resetTachoCount()
resetTachoCount in interface Encoderpublic int getRotationSpeed()
Tachometer
getRotationSpeed in interface Tachometer
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||