|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.phidgets.Phidget
com.phidgets.MotorControlPhidget
public final class MotorControlPhidget
This class represents a Phidget Motor Controller. All methods to to control a motor controller and read back motor data are implemented in this class.
The Motor Control Phidget is able to control 1 or more DC motors. Both speed and acceleration are controllable. Speed is controlled via PWM. The size of the motors that can be driven depends on the motor controller. See your hardware documentation for more information.
The motor Controller boards also has 0 or more digital inputs.
Constructor Summary | |
---|---|
MotorControlPhidget()
|
Method Summary | |
---|---|
void |
addCurrentChangeListener(CurrentChangeListener l)
Adds a current change listener. |
void |
addInputChangeListener(InputChangeListener l)
Adds an input change listener. |
void |
addMotorVelocityChangeListener(MotorVelocityChangeListener l)
Adds a velocity change listener. |
double |
getAcceleration(int index)
Returns a motor's acceleration. |
int |
getInputCount()
Returns the number of digital inputs. |
boolean |
getInputState(int index)
Returns the state of a digital input. |
int |
getMotorCount()
Returns the number of motors supported by this Phidget. |
double |
getSpeed(int index)
Returns a motor's speed. |
void |
removeCurrentChangeListener(CurrentChangeListener l)
|
void |
removeInputChangeListener(InputChangeListener l)
|
void |
removeMotorVelocityChangeListener(MotorVelocityChangeListener l)
|
void |
setAcceleration(int index,
double acceleration)
Sets a motor's acceleration. |
void |
setSpeed(int index,
double speed)
Sets a motor's speed. |
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 MotorControlPhidget() throws PhidgetException
PhidgetException
Method Detail |
---|
public int getMotorCount() throws PhidgetException
PhidgetException
- If this Phidget is not opened and attached.
See open
for information on determining if a device is attached.public int getInputCount() throws PhidgetException
PhidgetException
- If this Phidget is not opened and attached.
See open
for information on determining if a device is attached.public boolean getInputState(int index) throws PhidgetException
index
- index of the input
PhidgetException
- If this Phidget is not opened and attached, or if the index is invalid.
See open
for information on determining if a device is attached.public double getAcceleration(int index) throws PhidgetException
index
- index of motor
PhidgetException
- If this Phidget is not opened and attached, or if the index is invalid.
See open
for information on determining if a device is attached.public void setAcceleration(int index, double acceleration) throws PhidgetException
index
- index of the motoracceleration
- requested acceleration for that motor
PhidgetException
- If this Phidget is not opened and attached, or if the index or acceleration value are invalid.
See open
for information on determining if a device is attached.public double getSpeed(int index) throws PhidgetException
index
- index of the motor
PhidgetException
- If this Phidget is not opened and attached, or if the index is invalid.
See open
for information on determining if a device is attached.public void setSpeed(int index, double speed) throws PhidgetException
index
- index of the motorspeed
- requested speed foe the motor
PhidgetException
- If this Phidget is not opened and attached, or if the index or speed value are invalid.
See open
for information on determining if a device is attached.public final void addMotorVelocityChangeListener(MotorVelocityChangeListener l)
There is no limit on the number of velocity change handlers that can be registered for a particular Phidget.
l
- An implemetation of the MotorVelocityChangeListener
interfacepublic final void removeMotorVelocityChangeListener(MotorVelocityChangeListener l)
public final void addCurrentChangeListener(CurrentChangeListener l)
There is no limit on the number of current change handlers that can be registered for a particular Phidget.
l
- An implemetation of the CurrentChangeListener
interfacepublic final void removeCurrentChangeListener(CurrentChangeListener l)
public final void addInputChangeListener(InputChangeListener l)
There is no limit on the number of input change handlers that can be registered for a particular Phidget.
l
- An implemetation of the InputChangeListener
interfacepublic final void removeInputChangeListener(InputChangeListener l)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |