Magnetometer
Last updated
Last updated
The magnetometer is used to measure magnetic flux density. This is the total magnetic field passing through a given area, per metre squared, . The sensor will returns values with units of microtesla for each of the three coordinate axes; x, y and, z. The magnetic flux density is quite similar to magnetic field strength.
When the magnetometer detects a change in the ambient magnetic field the Changes
event will fire. The event returns 4 parameters that we can work with.
Parameter | Type | Returns |
| Number | Flux density, in the x direction, expressed in |
| Number | Flux density, in the y direction, expressed in |
| Number | Flux density, in the z direction, expressed in |
| String | Error message from the Sensor |
Returns flux density, in the x direction, expressed in
Returns flux density, in the y direction, expressed in
Returns flux density, in the x direction, expressed in
Returns a value between 0 and 360 which denotes the user's direction relative to the Earth's geographic North Pole
The magnetometer is, by default, turned on, but the enabled
property can be used to turn in on and off by setting it to true
or false
respectively.
Property | Type | Default |
| Bool | true |
| Bool | true |