lejos.nxt
Class LServo

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

public class LServo
extends I2CSensor

LServo, Lattebox Servo, is a abstraction to model any Servo connected to LSC, Lattebox Servo Controller.

Author:
Juan Antonio Brenha Moral

Field Summary
 
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
 
Method Summary
 int getAngle(int Servo)
          Method to know the angle Note: In next version, I will delete servo parameter, because the object should know servo id.
 String getName()
          Get servo name
 void goToMaxAngle()
          Method to set maximum angle
 void goToMiddleAngle()
          Method to set medium angle
 void goToMinAngle()
          Method to set minimal angle
 boolean isMoving()
          Method to know if Servo is moving to a determinated angle
 int readMotion()
          public method to know internal information about if the servo is moving
 void setAngle(int servo, int angle)
          Method to setAngle in Servo.
 void setDelay(int Servo, int delay)
          Set a delay in Servo Note: In next version, I will delete servo parameter, because the object should know servo id.
 void setMaxAngle(int maxAngle)
          Set Maximum angle.
 void setMinAngle(int minAngle)
          Set Minimal angle.
 
Methods inherited from class lejos.nxt.I2CSensor
getData, getPort, getProductID, getSensorType, getVersion, sendData, sendData, setAddress
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait
 

Constructor Detail

LServo

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

Parameters:
port -
location -
servoName -
SPI_PORT - Author: Juan Antonio Brenha Moral
Method Detail

setAngle

public void setAngle(int servo,
                     int angle)
              throws Exception
Method to setAngle in Servo. Note: In next version, I will delete servo parameter, because the object should know servo id.

Parameters:
servo -
angle -
Throws:
Exception - Author: Juan Antonio Brenha Moral

getAngle

public int getAngle(int Servo)
             throws Exception
Method to know the angle Note: In next version, I will delete servo parameter, because the object should know servo id.

Parameters:
Servo -
Returns:
angle
Throws:
Exception

readMotion

public int readMotion()
               throws Exception
public method to know internal information about if the servo is moving

Returns:
motion
Throws:
Exceptionl
Exception

isMoving

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

Returns:
true iff the serv is moving
Throws:
Exception

setDelay

public void setDelay(int Servo,
                     int delay)
Set a delay in Servo Note: In next version, I will delete servo parameter, because the object should know servo id.

Parameters:
Servo -
delay -

setMinAngle

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

Parameters:
minAngle -

setMaxAngle

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

Parameters:
maxAngle -

goToMinAngle

public void goToMinAngle()
                  throws Exception
Method to set minimal angle

Throws:
Exception

goToMaxAngle

public void goToMaxAngle()
                  throws Exception
Method to set maximum angle

Throws:
Exception

goToMiddleAngle

public void goToMiddleAngle()
                     throws Exception
Method to set medium angle

Throws:
Exception

getName

public String getName()
Get servo name