Alphabot2 for micro:bit User Manual
22 / 76
Magnetic Force:
We create a script to show the intensity of magnetic force by bar graph (LEDs)
1. Place plot bar graph of block to forever, which is in Led package
2. Place magnetic force (uT) block on the bar block, which can be found on
Input->More, than set the max value to 255
3. Download the script to your micro:bit
4. When you first time run the code on micro:bit, it will scroll text “to fill screen” to
tell you that calibration step should be done first. Then you should to fill the LED
screen by tilting the micro:bit. After lighting all the LEDs, a smiley is displayed to
show you that calibration is finished.
5. The expected result is that a few of LEDs are lighted if there are not any magnetic
things, and if you close a speaker
to the micro:bit, more LEDs will be lighted
Compass
With accelerometer, we can get the direction of gravity, which is downward.
Magnetometer is influenced by earth’s magnetic field, horizontal component of