The magnetometer is used to measure magnetic flux density. This is the total magnetic field passing through a given area, per metre squared,
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 |
---|---|---|
xFluxDensity |
Number | Flux density, in the x direction, expressed in |
yFluxDensity |
Number | Flux density, in the y direction, expressed in |
zFluxDensity |
Number | Flux density, in the z direction, expressed in |
error |
String | Error message from the Sensor |
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 |
---|---|---|
set Enabled |
Bool | true |
get Enabled |
Bool | true |