SunSPOT API V5.0


com.sun.spot.sensorboard.peripheral
Class Servo

java.lang.Object
  extended by com.sun.spot.sensorboard.peripheral.Servo
All Implemented Interfaces:
IServo

public class Servo
extends Object
implements IServo

A basic servo. Note: whenever a servo is active, deep sleep will not happen.

Author:
arshan

Constructor Summary
Servo(IOutputPin pin)
          Initialize a servo.
 
Method Summary
 IServoController getController()
          Return the servocontroller of this servo.
 int getValue()
          Return the current value of this servos pulse length.
 void setBounds(int low, int high)
          Specify the bounds that this servo can operate in.
 void setPosition(float position)
          Set the relative position of this servo.
 void setValue(int val)
          Set the pulse width size of this servo.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Servo

public Servo(IOutputPin pin)
Initialize a servo. For the eDemo board the H0-H3 and D0-D3 pins can be used as servos.

Parameters:
pin - the pin that this servo is attached to
Method Detail

setValue

public void setValue(int val)
Set the pulse width size of this servo. This pulse will be delivered to the servo at correct intervals as long as the SevoController responsible for this servo is active.

Specified by:
setValue in interface IServo
Parameters:
val - pulse width in microseconds

getValue

public int getValue()
Return the current value of this servos pulse length.

Specified by:
getValue in interface IServo
Returns:
pulse width in microseconds

setPosition

public void setPosition(float position)
Set the relative position of this servo. The argument should be a valid float from 0.0 to 1.0, the servo pulse width size will be set to that percentage of the value from its lower bound and upper bound. ie. setPosition(0.5) will set the servo to its half way point.

Specified by:
setPosition in interface IServo
Parameters:
position - percentage value to set the servo to

setBounds

public void setBounds(int low,
                      int high)
Specify the bounds that this servo can operate in. This method is used to restrict the settings of this servo as used with the setPosition method.

Specified by:
setBounds in interface IServo
Parameters:
low - pulse width value in microseconds
high - pulse width value in microseconds

getController

public IServoController getController()
Return the servocontroller of this servo.

Specified by:
getController in interface IServo
Returns:
the servo controller responsible for this servo

SunSPOT API V5.0


Copyright � 2006-2008 Sun Microsystems, Inc. All Rights Reserved.