|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.phidgets.Phidget
com.phidgets.AccelerometerPhidget
This class represents a Phidget Accelerometer. All methods to read acceleration data from an Accelerometer are implemented in this class.
The Phidget Accelerometer provides 2 or 3 axes of acceleration data, at anywhere from 2g to 10g sensitivity, depending on the specific revision. See your hardware documetation for more information. They can measure both static (gravity) and dynamic acceleration.
Field Summary |
Constructor Summary | |
AccelerometerPhidget()
|
Method Summary | |
void |
addAccelerationChangeListener(AccelerationChangeListener l)
Adds an acceleration change listener. |
double |
getAcceleration(int index)
Returns the acceleration of a particular axis. |
double |
getAccelerationChangeTrigger(int index)
Returns the change trigger for an Axis. |
double |
getAccelerationMax(int index)
Returns the maximum acceleration value that this axis will report. |
double |
getAccelerationMin(int index)
Returns the minimum acceleration value that this axis will report. |
int |
getAxisCount()
Returns the number of accelerometer axes. |
void |
removeAccelerationChangeListener(AccelerationChangeListener l)
|
void |
setAccelerationChangeTrigger(int index,
double newVal)
Sets the change trigger for an Axis. |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public AccelerometerPhidget() throws PhidgetException
Method Detail |
public int getAxisCount() throws PhidgetException
PhidgetException
public double getAcceleration(int index) throws PhidgetException
This value will always be between getAccelerationMin
and getAccelerationMax
.
Index 0 is the x-axis, 1 is the y-axis, and 2 is the z-axis (where available).
index
- index of the axis
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 double getAccelerationMax(int index) throws PhidgetException
PhidgetException
public double getAccelerationMin(int index) throws PhidgetException
PhidgetException
public void setAccelerationChangeTrigger(int index, double newVal) throws PhidgetException
index
- index of the axisnewVal
- the new change trigger for this axis
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 double getAccelerationChangeTrigger(int index) throws PhidgetException
index
- index of the axis
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 addAccelerationChangeListener(AccelerationChangeListener l)
Trigger
that has been set for that axis.
There is no limit on the number of acceleration change handlers that can be registered for a particular Phidget.
l
- An implemetation of the AccelerationChangeListener
interfacepublic final void removeAccelerationChangeListener(AccelerationChangeListener l)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |