Class BO.io.MagnetometerHMC5883
Extends
BO.I2CBase.
Creates an interface to an HMC5883 3-axis magnetometer. Use the
magnetometer to obtain a compass heading or rotation in relation to
a fixed point. See Breakout/examples/sensors/hmc5883.html for an example
application.
Defined in: MagnetoMeterHMC5883.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
BO.io.MagnetometerHMC5883(board, address, numSamples, outputRate)
HMC5883 3-axis magnetometer
|
| Field Attributes | Field Name and Description |
|---|---|
| <static> <constant> |
BO.io.MagnetometerHMC5883.DEVICE_ID
|
|
[read-only] The heading in degrees.
|
|
| <static> |
BO.io.MagnetometerHMC5883.HZ_0_75
0.75 Hz @constant
|
| <static> |
BO.io.MagnetometerHMC5883.HZ_15
15 Hz @constant
|
| <static> |
BO.io.MagnetometerHMC5883.HZ_1_5
1.5 Hz @constant
|
| <static> |
BO.io.MagnetometerHMC5883.HZ_3
3 Hz @constant
|
| <static> |
BO.io.MagnetometerHMC5883.HZ_30
30 Hz @constant
|
| <static> |
BO.io.MagnetometerHMC5883.HZ_75
75 Hz @constant
|
| <static> |
BO.io.MagnetometerHMC5883.HZ_7_5
7.5 Hz @constant
|
| <static> <constant> |
BO.io.MagnetometerHMC5883.SAMPLES_1
|
| <static> <constant> |
BO.io.MagnetometerHMC5883.SAMPLES_2
|
| <static> <constant> |
BO.io.MagnetometerHMC5883.SAMPLES_4
|
| <static> <constant> |
BO.io.MagnetometerHMC5883.SAMPLES_8
|
|
[read-only] The x-axis measurement
|
|
|
[read-only] The y-axis measurement
|
|
|
[read-only] The z-axis measurement
|
- Fields borrowed from class BO.I2CBase:
- address, board
| Method Attributes | Method Name and Description |
|---|---|
|
Start continuous reading of the sensor
|
|
|
Stop continuous reading of the sensor
|
|
|
update()
Sends read request to magnetometer and updates magnetometer 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 compass heading is updated.
|
Class Detail
BO.io.MagnetometerHMC5883(board, address, numSamples, outputRate)
HMC5883 3-axis magnetometer
- Parameters:
- {IOBoard} board
- The IOBoard instance
- {Number} address
- The i2c address of the compass module
- {Number} numSamples
- The number of samples averaged per measurement output. Options are: MagnetometerHMC5883.SAMPLES_1, MagnetometerHMC5883.SAMPLES_2, MagnetometerHMC5883.SAMPLES_4 MagnetometerHMC5883.SAMPLES_8 (default = MagnetometerHMC5883.SAMPLES_1)
- {Number} outputRate
- The data output rate in Hz (default = MagnetometerHMC5883.HZ_30)
Field Detail
<static> <constant>
BO.io.MagnetometerHMC5883.DEVICE_ID
{Number}
heading
[read-only] The heading in degrees.
<static>
BO.io.MagnetometerHMC5883.HZ_0_75
0.75 Hz @constant
<static>
BO.io.MagnetometerHMC5883.HZ_15
15 Hz @constant
<static>
BO.io.MagnetometerHMC5883.HZ_1_5
1.5 Hz @constant
<static>
BO.io.MagnetometerHMC5883.HZ_3
3 Hz @constant
<static>
BO.io.MagnetometerHMC5883.HZ_30
30 Hz @constant
<static>
BO.io.MagnetometerHMC5883.HZ_75
75 Hz @constant
<static>
BO.io.MagnetometerHMC5883.HZ_7_5
7.5 Hz @constant
<static> <constant>
BO.io.MagnetometerHMC5883.SAMPLES_1
<static> <constant>
BO.io.MagnetometerHMC5883.SAMPLES_2
<static> <constant>
BO.io.MagnetometerHMC5883.SAMPLES_4
<static> <constant>
BO.io.MagnetometerHMC5883.SAMPLES_8
{Number}
x
[read-only] The x-axis measurement
{Number}
y
[read-only] The y-axis measurement
{Number}
z
[read-only] The z-axis measurement
Method Detail
startReading()
Start continuous reading of the sensor
stopReading()
Stop continuous reading of the sensor
update()
Sends read request to magnetometer and updates magnetometer values.
Event Detail
{BO.io.MagnetometerEvent.UPDATE}
update
The update event is dispatched when the compass heading is updated.
- This event has the following properties:
- {BO.io.MagnetometerHMC5883} target
- A reference to the MagnetometerHMC5883 object.
