lejos.nxt.addon
Class LServo

java.lang.Object
  extended by lejos.nxt.I2CSensor
      extended by lejos.nxt.addon.LMotor
          extended by lejos.nxt.addon.LServo
All Implemented Interfaces:
SensorConstants

public class LServo
extends LMotor

LServo, Lattebox Servo, is a abstraction to model any RC Servo (continous and non continous) plugged to LSC, Lattebox Servo Controller.

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
 
Fields inherited from class lejos.nxt.addon.LMotor
arrMotorLoad, arrMotorUnload, LSC_position, 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
LServo(SensorPort port, int location, String servoName, byte SPI_PORT)
          Constructor
LServo(SensorPort port, int location, String servoName, byte SPI_PORT, int min_angle, int max_angle)
          Constructor with the feature to set min and max angle
LServo(SensorPort port, int location, String servoName, byte SPI_PORT, int min_angle, int max_angle, int init_angle)
          Constructor with the feature to set min, max and init angle
 
Method Summary
 void backward()
          Classic backward method for continous RC Servos
 void forward()
          Classic forward method for continous RC Servos
 int getAngle()
          Method to know the angle
 void goToInitAngle()
          Method to set medium angle
 void goToMaxAngle()
          Method to set maximum angle
 void goToMiddleAngle()
          Method to set medium angle
 void goToMinAngle()
          Method to set minimal angle
 void setAngle(int angle)
          Method to set an Angle in a RC Servo.
 void setMaxAngle(int maxAngle)
          Set Maximum angle.
 void setMinAngle(int minAngle)
          Set Minimal angle.
 
Methods inherited from class lejos.nxt.addon.LMotor
getName, getPulse, isMoving, load, setDelay, setPulse, 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
 

Constructor Detail

LServo

public LServo(SensorPort port,
              int location,
              String servoName,
              byte SPI_PORT)
Constructor

Parameters:
port -
location -
servoName -
SPI_PORT -

LServo

public LServo(SensorPort port,
              int location,
              String servoName,
              byte SPI_PORT,
              int min_angle,
              int max_angle)
Constructor with the feature to set min and max angle

Parameters:
port -
location -
servoName -
SPI_PORT -
min_angle -
max_angle -

LServo

public LServo(SensorPort port,
              int location,
              String servoName,
              byte SPI_PORT,
              int min_angle,
              int max_angle,
              int init_angle)
Constructor with the feature to set min, max and init angle

Parameters:
port -
location -
servoName -
SPI_PORT -
min_angle -
max_angle -
init_angle -
Method Detail

setAngle

public void setAngle(int angle)
Method to set an Angle in a RC Servo.

Parameters:
angle -

getAngle

public int getAngle()
Method to know the angle

Returns:
the angle

setMinAngle

public void setMinAngle(int minAngle)
Set Minimal angle. Useful method to calibrate a Servo

Parameters:
minAngle - the minimum angle

setMaxAngle

public void setMaxAngle(int maxAngle)
Set Maximum angle. Useful method to calibrate a Servo

Parameters:
maxAngle -

goToMinAngle

public void goToMinAngle()
Method to set minimal angle


goToMaxAngle

public void goToMaxAngle()
Method to set maximum angle


goToMiddleAngle

public void goToMiddleAngle()
Method to set medium angle


goToInitAngle

public void goToInitAngle()
Method to set medium angle


forward

public void forward()
Classic forward method for continous RC Servos


backward

public void backward()
Classic backward method for continous RC Servos