The micro:bit measures magnetic force with microteslas.
You are asked to calibrate the compass the first time run a program that uses the compass.
Find the amount of magnetic force (the strength of a magnet) in one of the three directions.
input.magneticForce(Dimension.X);
The micro:bit measures magnetic force with microteslas.
You are asked to calibrate the compass the first time run a program that uses the compass.
Dimension.X
(the left-right direction),
Dimension.Y
(the forward/backward direction), or Dimension.Z
(the up/down direction)Create a metal detector my measuring the strength of magnetic force in the X
direction.
Display a bar graph to show the current level of magnetic force measured by the magnetometer.
basic.forever(function() {
led.plotBarGraph(input.magneticForce(Dimension.X) / 2000, 0)
})