|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lejos.nxt.MotorPort
public class MotorPort
Abstraction for a NXT output port.
Field Summary | |
---|---|
static MotorPort |
A
MotorPort A. |
static MotorPort |
B
MotorPort B. |
static MotorPort |
C
MotorPort C. |
static int |
NUMBER_OF_PORTS
The number of ports available. |
Fields inherited from interface lejos.nxt.BasicMotorPort |
---|
BACKWARD, FLOAT, FORWARD, MAX_POWER, PWM_BRAKE, PWM_FLOAT, STOP |
Method Summary | |
---|---|
void |
controlMotor(int power,
int mode)
Low-level method to control a motor. |
int |
getId()
|
static MotorPort |
getInstance(int id)
Return the MotorPort with the given Id. |
int |
getTachoCount()
returns tachometer count |
void |
resetTachoCount()
resets the tachometer count to 0; |
void |
setPWMMode(int mode)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NUMBER_OF_PORTS
public static final MotorPort A
public static final MotorPort B
public static final MotorPort C
Method Detail |
---|
public static MotorPort getInstance(int id)
id
- the Id, between 0 and NUMBER_OF_PORTS
-1.
public void controlMotor(int power, int mode)
controlMotor
in interface BasicMotorPort
power
- power from 0-100mode
- defined in BasicMotorPort
. 1=forward, 2=backward, 3=stop, 4=float.BasicMotorPort.FORWARD
,
BasicMotorPort.BACKWARD
,
BasicMotorPort.FLOAT
,
BasicMotorPort.STOP
public int getTachoCount()
getTachoCount
in interface Encoder
public void resetTachoCount()
resetTachoCount
in interface Encoder
public void setPWMMode(int mode)
setPWMMode
in interface BasicMotorPort
public int getId()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |