|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.phidgets.Phidget
com.phidgets.ServoPhidget
public final class ServoPhidget
This class represents a Phidget servo Controller. All methods to control a Servo Controller are implemented in this class.
The Phidget Sevo controller simply outputs varying widths of PWM, which is what most servo motors take as an input driving signal.
Constructor Summary | |
---|---|
ServoPhidget()
|
Method Summary | |
---|---|
void |
addServoPositionChangeListener(ServoPositionChangeListener l)
Adds a servo position change listener. |
int |
getMotorCount()
Returns the number of motors this Phidget can support. |
double |
getPosition(int index)
Returns the position of a servo motor. |
void |
removeServoPositionChangeListener(ServoPositionChangeListener l)
|
void |
setPosition(int index,
double position)
Sets the position of a servo motor. |
Methods inherited from class com.phidgets.Phidget |
---|
addAttachListener, addDetachListener, addErrorListener, close, equals, getDeviceName, getDeviceType, getDeviceVersion, getLibraryVersion, getSerialNumber, getTag, isAttached, open, openAny, removeAttachListener, removeDetachListener, removeErrorListener, setTag, toString, waitForAttachment |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ServoPhidget() throws PhidgetException
PhidgetException
Method Detail |
---|
public int getMotorCount() throws PhidgetException
PhidgetException
public double getPosition(int index) throws PhidgetException
The range here is -23 - 232, each corsponding aproximately to an angle in degrees. -23 corresponds to a PWM of 0, which means that the motor is not being driven at all, and so can be freely rotated. Note that most servos will not be able to operate accross this entire range.
index
- index of the motor
PhidgetException
- If this Phidget is not opened and attached, or if the index is out of range.
See open
for information on determining if a device is attached.public void setPosition(int index, double position) throws PhidgetException
The range here is -23 - 232, each corsponding aproximately to an angle in degrees. -23 corresponds to a PWM of 0, which means that the motor is not being driven at all, and so can be freely rotated. Note that most servos will not be able to operate accross this entire range. Typically, the range might be 25 - 180 degrees, but this depends on the servo
index
- index of the motorposition
- desired position
PhidgetException
- If this Phidget is not opened and attached, or if the index or position is out of range.
See open
for information on determining if a device is attached.public final void addServoPositionChangeListener(ServoPositionChangeListener l)
setPosition
.
There is no limit on the number of servo position change handlers that can be registered for a particular Phidget.
l
- An implemetation of the ServoPositionChangeListener
interfacepublic final void removeServoPositionChangeListener(ServoPositionChangeListener l)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |