|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectch.aplu.nxt.Part
ch.aplu.nxt.Sensor
ch.aplu.nxt.I2CSensor
ch.aplu.nxt.AccelerometerSensor
public class AccelerometerSensor
Class that represents a accelerometer sensor (HiTechnic).
The axis are defined as follows:
Put sensor with white cover upside, cable connector to the left
x-axis from right to left
y-axis from back to front
z-axis from top to bottom
The following register layout is assumed:
0x00-0x07 Version number
0x08-0x0F Manufacturer
0x10-0x17 Sensor type
0x42 X axis, upper 8bits
0x43 Y axis, upper 8bits
0x44 Z axis, upper 8bits
0x45 X axis, lower 2bits
0x46 Y axis, lower 2bits
0x47 Z axis, lower 2bits
Values are 10 bit in two's complement
| Field Summary |
|---|
| Constructor Summary | |
|---|---|
AccelerometerSensor()
Creates a sensor instance connected to port S1. |
|
AccelerometerSensor(SensorPort port)
Creates a sensor instance connected to the given port. |
|
| Method Summary | |
|---|---|
void |
addAccelerometerListener(AccelerometerListener listener,
boolean enableX,
boolean enableY,
boolean enableZ)
Registers the given accelerometer listener. |
int[] |
getAcceleration()
Returns the current acceleration in x, y, z direction (10 bit, two's complement, -512..511). |
| Methods inherited from class ch.aplu.nxt.I2CSensor |
|---|
getData, getLejosI2CSensor, getLejosPort, getProductID, getVersion, sendData, sendData |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AccelerometerSensor(SensorPort port)
port - the port where the sensor is plugged-inpublic AccelerometerSensor()
| Method Detail |
|---|
public int[] getAcceleration()
public void addAccelerometerListener(AccelerometerListener listener,
boolean enableX,
boolean enableY,
boolean enableZ)
listener - the AccelerometerListener to become registered.enableX - if true, x-axis value change triggers an eventenableY - if true, y-axis value change triggers an eventenableZ - if true, z-axis value change triggers an event
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||