|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.phidgets.Phidget
com.phidgets.EncoderPhidget
public final class EncoderPhidget
This class represents a Phidget Encoder. All methods to read encoder data from an encoder are implemented in this class.
Phidget Encoder boards generally support 1 or more encoders with 0 or more digital inputs. Both high speed optical and low speed mechanical encoders are supported with this API.
Constructor Summary | |
---|---|
EncoderPhidget()
|
Method Summary | |
---|---|
void |
addEncoderPositionChangeListener(EncoderPositionChangeListener l)
Adds a position change listener. |
void |
addInputChangeListener(InputChangeListener l)
Adds an input change listener. |
int |
getEncoderCount()
Returns number of encoders. |
int |
getEncoderPosition(int index)
Returns the position of an encoder. |
int |
getInputCount()
Returns number of digital inputs. |
boolean |
getInputState(int index)
Returns the state of a digital input. |
void |
removeEncoderPositionChangeListener(EncoderPositionChangeListener l)
|
void |
removeInputChangeListener(InputChangeListener l)
|
void |
setEncoderPosition(int index,
int position)
Sets the position of a specific encoder. |
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 EncoderPhidget() throws PhidgetException
PhidgetException
Method Detail |
---|
public int getEncoderCount() 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 int getEncoderPosition(int index) throws PhidgetException
setEncoderPosition
.
index
- index of the encoder
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 setEncoderPosition(int index, int position) throws PhidgetException
getEncoderPosition
.
index
- index of the encoderposition
- new position for this encoder.
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 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 out of range.
See open
for information on determining if a device is attached.public final void addEncoderPositionChangeListener(EncoderPositionChangeListener l)
getEncoderPosition
.
There is no limit on the number of position change handlers that can be registered for a particular Phidget.
l
- An implemetation of the EncoderPositionChangeListener
interfacepublic final void removeEncoderPositionChangeListener(EncoderPositionChangeListener 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 |