MAG3110 Class
- ID: mag3110
- Name: MAG3110 Three-Axis Digital Magnetometer
- Category: accelerometer compass
- Manufacturer: freescale
- Link: http://www.nxp.com/assets/documents/data/en/data-sheets/MAG3110.pdf
- Connection: i2c
Description in web-link above: The MAG3110 is a small, low-power digital 3D magnetic sensor with a wide dynamic range to allow operation in PCBs with high extraneous magnetic fields. It measures the components of the local magnetic field, the sum of the geomagnetic field and the magnetic field created by components on the circuit board. It can be used in conjunction with a 3-axis accelerometer so that orientation-independent accurate compass heading information may be achieved It is capable of measuring local magnetic fields up to 10 Gauss with output data rates up to 80 Hz.
Item Index
Methods
MAG3110
-
bus
-
dros
-
devAddr
Instantiates an MAG3110 object
Parameters:
-
bus
NumberNumber of the used bus
-
dros
NumberData rate and over sampling selection
-
devAddr
NumberAddress of the used I2C device
Returns:
checkID
()
Number
Check device_id of sensor
Returns:
0 on success -1 on error
setUserOffset
-
x
-
y
-
z
Set user offset correction Offset correction register will be erased after accelerometer reset
Parameters:
-
x
NumberOffset correction value for x-axis
-
y
NumberOffset correction value for y-axis
-
z
NumberOffset correction value for z-axis
Returns:
0 on success -1 on error
setActive
()
Number
Set active mode, this enables periodic measurements
Returns:
0 on success -1 on error
setStandby
()
Number
Set standby mode, this disables periodic measurements
Returns:
0 on success -1 on error
isReady
()
Number
Check for new set of measurement data.
Returns:
>0 if x-, y- and z-axis new sample is ready 0 if measurement is in progress
sampleData
()
Number
Read magnetometer's data and saves them to variables
Info: To get the actual values for the magnetic field someone has to divide the returned values from the magnetometer by 10
Returns:
0 on success -1 on error
getX
-
bSampleData
Get x-axis magnetic field strength
Parameters:
-
bSampleData
NumberFlag to read sensor
Returns:
The x-axis magnetic field strength on success -999 on error
getY
-
bSampleData
Get y-axis magnetic field strength
Parameters:
-
bSampleData
NumberFlag to read sensor
Returns:
The y-axis magnetic field strength on success -999 on error
getZ
-
bSampleData
Get z-axis magnetic field strength
Parameters:
-
bSampleData
NumberFlag to read sensor
Returns:
The z-axis magnetic field strength on success -999 on error
getStatus
()
Number
Get value of status register
Returns:
Value of status register
getDieTemperature
()
Number
Get die temperature
Returns:
Die temperature
getData
-
data
-
bSampleData
Get sensor values
Parameters:
-
data
Mag3110_data_tSensor values
-
bSampleData
NumberFlag to read sensor
Returns:
0 on success -1 on error