Package lejos.hardware.sensor
Class HiTechnicAccelerometer
- java.lang.Object
-
- lejos.hardware.Device
-
- lejos.hardware.sensor.BaseSensor
-
- lejos.hardware.sensor.I2CSensor
-
- lejos.hardware.sensor.HiTechnicAccelerometer
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,SensorConstants,SensorMode,SensorModes,SampleProvider
public class HiTechnicAccelerometer extends I2CSensor
HiTechnic NXT Acceleration / Tilt Sensor (NAC1040)
The HiTechnic Accelerometer / Tilt Sensor measures acceleration in three axes.Supported modes Mode name Description unit(s) Getter Acceleration Measures acceleration over three axes. meter / second2 getAccelerationMode()See Sensor Product page (Some details from HTAC-driver.h from http://botbench.com/blog/robotc-driver-suite/) See The leJOS sensor framework See
leJOS conventions for SampleProviders- Author:
- Lawrie Griffiths, Michael Mirwaldt
-
-
Field Summary
-
Fields inherited from class lejos.hardware.sensor.I2CSensor
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION, retryCount
-
Fields inherited from class lejos.hardware.sensor.BaseSensor
currentMode, modes
-
Fields inherited from interface lejos.hardware.sensor.SensorConstants
BLACK, BLANK_INDEX, BLUE, BLUE_INDEX, BROWN, GREEN, GREEN_INDEX, MAX_TYPE, MIN_TYPE, MODE_RAW, NXT_ADC_RES, RED, RED_INDEX, TYPE_ANGLE, TYPE_COLORBLUE, TYPE_COLORFULL, TYPE_COLORGREEN, TYPE_COLORNONE, TYPE_COLORRED, TYPE_CUSTOM, TYPE_HIGHSPEED, TYPE_HIGHSPEED_9V, TYPE_HISPEED, TYPE_LIGHT_ACTIVE, TYPE_LIGHT_INACTIVE, TYPE_LOWSPEED, TYPE_LOWSPEED_9V, TYPE_NO_SENSOR, TYPE_REFLECTION, TYPE_SOUND_DB, TYPE_SOUND_DBA, TYPE_SWITCH, TYPE_TEMPERATURE, WHITE, YELLOW
-
-
Constructor Summary
Constructors Constructor Description HiTechnicAccelerometer(I2CPort port)Creates a SampleProvider for the HiTechnic Acceleration SensorHiTechnicAccelerometer(I2CPort port, int address)Creates a SampleProvider for the HiTechnic Acceleration SensorHiTechnicAccelerometer(Port port)Creates a SampleProvider for the HiTechnic Acceleration SensorHiTechnicAccelerometer(Port port, int address)Creates a SampleProvider for the HiTechnic Acceleration Sensor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SensorModegetAccelerationMode()HiTechnic NXT Acceleration , Acceleration mode
Measures acceleration over three axes.protected voidinit()-
Methods inherited from class lejos.hardware.sensor.I2CSensor
fetchString, getAddress, getData, getData, getPort, getProductID, getRetryCount, getVendorID, getVersion, sendData, sendData, sendData, setAddress, setRetryCount
-
Methods inherited from class lejos.hardware.sensor.BaseSensor
fetchSample, getAvailableModes, getCurrentMode, getMode, getMode, getModeCount, getName, sampleSize, setCurrentMode, setCurrentMode, setModes
-
Methods inherited from class lejos.hardware.Device
close, releaseOnClose
-
-
-
-
Constructor Detail
-
HiTechnicAccelerometer
public HiTechnicAccelerometer(I2CPort port, int address)
Creates a SampleProvider for the HiTechnic Acceleration Sensor- Parameters:
port- the I2C portaddress- the I2C address of the sensor
-
HiTechnicAccelerometer
public HiTechnicAccelerometer(I2CPort port)
Creates a SampleProvider for the HiTechnic Acceleration Sensor- Parameters:
port- the I2C port
-
HiTechnicAccelerometer
public HiTechnicAccelerometer(Port port, int address)
Creates a SampleProvider for the HiTechnic Acceleration Sensor- Parameters:
port- the sensor portaddress- the I2C address of the sensor
-
HiTechnicAccelerometer
public HiTechnicAccelerometer(Port port)
Creates a SampleProvider for the HiTechnic Acceleration Sensor- Parameters:
port- the I2C port
-
-
Method Detail
-
init
protected void init()
-
getAccelerationMode
public SensorMode getAccelerationMode()
HiTechnic NXT Acceleration , Acceleration mode
Measures acceleration over three axes.Size and content of the sample
The sample contains 3 elements, containing acceleration over the X, Y and Z axis respectively. The range of the sensor is -2 to 2 G (1G = 9.81 m/s2).- Returns:
- A sampleProvider
See
leJOS conventions for SampleProvidersSee Sensor datasheet
-
-