Class BO.io.AccelerometerADXL345
Extends
BO.I2CBase.
Creates an interface to an ADXL345 3-axis accelerometer. Use the
accelerometer to read the acceleration along the x, y, and z axis of an
object it is attached to. You can also obtain the pitch and roll. See the
example in Breakout/examples/sensors/adxl345.html.
Defined in: AccelerometerADXL345.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
BO.io.AccelerometerADXL345(board, range, address)
Analog Devices ADXL345 3-axis accelerometer
|
| Field Attributes | Field Name and Description |
|---|---|
| <static> <constant> |
BO.io.AccelerometerADXL345.DEFAULT_SENSITIVITY
|
| <static> <constant> |
BO.io.AccelerometerADXL345.DEVICE_ID
|
|
[read-only] the accelerometer dynamic range in Gs (either 2G, 4G, 8G, or 16G for this sensor).
|
|
|
[read-only] The state of continuous read mode.
|
|
|
[read-only] The pitch value in degrees
|
|
| <static> <constant> |
BO.io.AccelerometerADXL345.RANGE_16G
|
| <static> <constant> |
BO.io.AccelerometerADXL345.RANGE_2G
|
| <static> <constant> |
BO.io.AccelerometerADXL345.RANGE_4G
|
| <static> <constant> |
BO.io.AccelerometerADXL345.RANGE_8G
|
|
The raw value of the x axis
|
|
|
The raw value of the y axis
|
|
|
The raw value of the z axis
|
|
|
[read-only] The roll value in degrees
|
|
|
The sensitivity value for the x axis (default value = 0.0390625).
|
|
|
The sensitivity value for the y axis (default value = 0.0390625).
|
|
|
The sensitivity value for the z axis (default value = 0.0390625).
|
|
|
[read-only] The acceleration value in Gs (9.8m/sec^2) along the x-axis.
|
|
|
[read-only] The acceleration value in Gs (9.8m/sec^2) along the y-axis.
|
|
|
[read-only] The acceleration value in Gs (9.8m/sec^2) along the z-axis.
|
- Fields borrowed from class BO.I2CBase:
- address, board
| Method Attributes | Method Name and Description |
|---|---|
|
get the value of the x, y, and z axis offset
|
|
|
setAxisOffset(xVal, yVal, zVal)
offset the x, y, or z axis output by the respective input value
|
|
|
Start continuous reading of the sensor
|
|
|
Stop continuous reading of the sensor
|
|
|
update()
Sends read request to accelerometer and updates accelerometer values.
|
- Methods borrowed from class BO.I2CBase:
- addEventListener, dispatchEvent, handleI2C, hasEventListener, removeEventListener, sendI2CRequest
| Event Attributes | Event Name and Description |
|---|---|
|
The update event is dispatched when the accelerometer values are updated.
|
Class Detail
BO.io.AccelerometerADXL345(board, range, address)
Analog Devices ADXL345 3-axis accelerometer
- Parameters:
- {IOBoard} board
- The IOBoard instance
- {Number} range
- The dynamic range selection in Gs (options RANGE_2G, RANGE_4G, RANGE_8G, RANGE_16G). Default is RANGE_2G.
- {Number} address
- The i2c address of the accelerometer (default is 0x53)
Field Detail
<static> <constant>
BO.io.AccelerometerADXL345.DEFAULT_SENSITIVITY
<static> <constant>
BO.io.AccelerometerADXL345.DEVICE_ID
{Number}
dynamicRange
[read-only] the accelerometer dynamic range in Gs (either 2G, 4G, 8G, or 16G for this sensor)..
{Boolean}
isRunning
[read-only] The state of continuous read mode. True if continuous read mode
is enabled, false if it is disabled.
{Number}
pitch
[read-only] The pitch value in degrees
<static> <constant>
BO.io.AccelerometerADXL345.RANGE_16G
<static> <constant>
BO.io.AccelerometerADXL345.RANGE_2G
<static> <constant>
BO.io.AccelerometerADXL345.RANGE_4G
<static> <constant>
BO.io.AccelerometerADXL345.RANGE_8G
{Number}
rawX
The raw value of the x axis
{Number}
rawY
The raw value of the y axis
{Number}
rawZ
The raw value of the z axis
{Number}
roll
[read-only] The roll value in degrees
{Number}
sensitivityX
The sensitivity value for the x axis (default value = 0.0390625).
{Number}
sensitivityY
The sensitivity value for the y axis (default value = 0.0390625).
{Number}
sensitivityZ
The sensitivity value for the z axis (default value = 0.0390625).
{Number}
x
[read-only] The acceleration value in Gs (9.8m/sec^2) along the x-axis.
{Number}
y
[read-only] The acceleration value in Gs (9.8m/sec^2) along the y-axis.
{Number}
z
[read-only] The acceleration value in Gs (9.8m/sec^2) along the z-axis.
Method Detail
getAxisOffset()
get the value of the x, y, and z axis offset
setAxisOffset(xVal, yVal, zVal)
offset the x, y, or z axis output by the respective input value
- Parameters:
- xVal
- yVal
- zVal
startReading()
Start continuous reading of the sensor
stopReading()
Stop continuous reading of the sensor
update()
Sends read request to accelerometer and updates accelerometer values.
Event Detail
{BO.io.AccelerometerEvent.UPDATE}
update
The update event is dispatched when the accelerometer values are updated.
- This event has the following properties:
- {BO.io.AccelerometerADXL345} target
- A reference to the AccelerometerADXL345 object.
