|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--josx.platform.rcx.Servo
Implmentation of a servo using a Motor and a Rotation Sensor.
Constructor Summary | |
Servo(Sensor sensor,
Motor motor)
Constructor. |
|
Servo(Sensor sensor,
Motor motor,
int slack)
Constructor. |
Method Summary | |
boolean |
rotateTo(int pos)
Set the motor rotating to the specified position. |
void |
stateChanged(Sensor sensor,
int oldValue,
int newValue)
Called by the sensor listener thread when the value of the rotation sensor changes. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait |
Constructor Detail |
public Servo(Sensor sensor, Motor motor, int slack)
sensor
- the Sensor to which the rotation sensor is connected.motor
- the Motor to control.slack
- accept positions +/- this value.public Servo(Sensor sensor, Motor motor)
Method Detail |
public boolean rotateTo(int pos)
pos
- the position to rotate to. The effect will depend
on the gearing used between the motor and the sensor and the
motor and the wheels (or whatever).
public void stateChanged(Sensor sensor, int oldValue, int newValue)
stateChanged
in interface SensorListener
sensor
- The sensor that generated the event.oldValue
- The old sensor value.newValue
- The new sensor value.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |