UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

Hmc5883l Class

Module: hmc5883l

Honeywell HMC5883L is a 3-axis digital compass. Communication with HMC5883L is simple and all done through an I2C interface. Different breakout boards are available. Typically, a 3V supply is all that is needed to power the sensor.
hmc5883l.jpeg

Methods

Hmc5883l

(
  • bus
)
Number

Creates an Hmc5883l object. The I2C address cannot be changed, and is always 0x1e (7-bit).

Parameters:

  • bus Number

    I2C bus number

Returns:

Number:

direction

() Number

Returns:

Number:

heading

() Number

Returns:

Number:

coordinates

() Const int16_t *

Returns a pointer to an int[3] that contains the coordinates as ints

Returns:

Const int16_t *:

*int to an int[3]

update

() Upm_result_t

Updates the values by reading from I2C

Returns:

Upm_result_t:

0 if successful

set_declination

(
  • dec
)

Sets the magnetic declination for better calibration

Parameters:

  • dec Number

    undefined

get_declination

() Number

Gets the current magnetic declination value

Returns:

Number:

Magnetic declination as a floating-point value