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

WARNING: THIS CLASS IS SHARED BETWEEN THE classes AND pccomms PROJECTS. DO NOT EDIT THE VERSION IN pccomms AS IT WILL BE OVERWRITTEN WHEN THE PROJECT IS BUILT.

Field Summary
static int[] arrMotorLoad
           
static int[] arrMotorUnload
           
protected  int LSC_position
           
protected  byte SPI_PORT
           
 
Fields inherited from interface lejos.nxt.SensorConstants
MODE_ANGLESTEP, MODE_BOOLEAN, MODE_CELSIUS, MODE_FARENHEIT, MODE_PCTFULLSCALE, MODE_PERIODCOUNTER, MODE_RAW, MODE_TRANSITIONCNT, TYPE_ANGLE, TYPE_CUSTOM, 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
 
Constructor Summary
LMotor(SensorPort port, int location, String name, byte SPI_PORT)
          Constructor
 
Method Summary
 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, getData, getPort, getProductID, getSensorType, getVersion, 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,
              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 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