lejos.nxt.addon
Class LMotor

java.lang.Object
  extended by lejos.nxt.I2CSensor
      extended by lejos.nxt.addon.LMotor
All Implemented Interfaces:
SensorConstants
Direct Known Subclasses:
LDCMotor, LServo

public class LMotor
extends I2CSensor

Generic abstraction to manage RC Servos and DC Motor. LServo and LDCMotor uses inherits from this class

Author:
Juan Antonio Brenha Moral

Field Summary
static int[] arrMotorLoad
           
static int[] arrMotorUnload
           
protected  int LSC_position
           
protected  byte SPI_PORT
           
 
Fields inherited from class lejos.nxt.I2CSensor
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION
 
Fields inherited from interface lejos.nxt.SensorConstants
BLACK, BLANK_INDEX, BLUE, BLUE_INDEX, GREEN, GREEN_INDEX, MAX_AD_RAW, MAX_TYPE, MIN_TYPE, MODE_ANGLESTEP, MODE_BOOLEAN, MODE_CELSIUS, MODE_FARENHEIT, MODE_PCTFULLSCALE, MODE_PERIODCOUNTER, MODE_RAW, MODE_TRANSITIONCNT, RED, RED_INDEX, TYPE_ANGLE, TYPE_COLORBLUE, TYPE_COLORFULL, TYPE_COLORGREEN, TYPE_COLORNONE, TYPE_COLORRED, TYPE_CUSTOM, 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 Summary
LMotor(SensorPort port, int location, java.lang.String name, byte SPI_PORT)
          Constructor
 
Method Summary
 java.lang.String getName()
          Get name from a RC Servo or a DC Motor
protected  int getPulse()
          This method return current pulse over a RC Servo or a DC Motor.
 boolean isMoving()
          Method to know if Servo is moving to a determinated angle
 void load()
          Load Servo located in a position X
 void setDelay(int delay)
          Set a delay in a Motor
protected  void setPulse(int pulse)
          This class set the Pulse over a RC Servo or a DC Motor
 void unload()
           
 
Methods inherited from class lejos.nxt.I2CSensor
fetchString, getAddress, getData, getData, getData, getId, getProductID, getVendorID, getVersion, sendData, sendData, sendData, setAddress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LSC_position

protected int LSC_position

SPI_PORT

protected byte SPI_PORT

arrMotorUnload

public static final int[] arrMotorUnload

arrMotorLoad

public static final int[] arrMotorLoad
Constructor Detail

LMotor

public LMotor(SensorPort port,
              int location,
              java.lang.String name,
              byte SPI_PORT)
Constructor

Parameters:
port - the port
location - the location
name - the name of the servo
SPI_PORT - the SPI port
Method Detail

isMoving

public boolean isMoving()
Method to know if Servo is moving to a determinated angle

Returns:
true iff the servo is moving

setDelay

public void setDelay(int delay)
Set a delay in a Motor

Parameters:
delay - the delay

unload

public void unload()

load

public void load()
Load Servo located in a position X


getName

public java.lang.String getName()
Get name from a RC Servo or a DC Motor


setPulse

protected void setPulse(int pulse)
This class set the Pulse over a RC Servo or a DC Motor

Parameters:
pulse -

getPulse

protected int getPulse()
This method return current pulse over a RC Servo or a DC Motor. This method is used internally by LDCMotor Objects or LServo Objects to get the speed or angle.

Returns:
the pulse