Welcome to Tiny:bit Robot Car repository
当製品の日本語版マニュアル資料は、こちらからご取得ください。
6.12 Wobble when touch
1.Preparation
This course mainly uses the geomagnetic sensor that comes with micro:bit. In addition to detecting the strength of the earth's magnetic field, the geomagnetic sensor can also be used as an electronic compass to determine the direction.
! ! ! Note: If you have an experiment with a geomagnetic sensor, we must calibrate compass because the local magnetic field is different at each location and has large effect on the results.
When the program download is complete, micro:bit will prompt calibration, the screen (LED dot matrix) prompts: “TILT TO FILL SCREEN”, then enters the calibration interface.
The calibration method :
Tilt the micro:bit, make 5x5 dot matrix on the micro:bit board is all lit, as shown in the following figure:
Then a smile will appear on the micro:bit dot matrix to indicate that the calibration is complete.

Programming method:
Mode 1 online programming: First, we need to connect the micro:bit to the computer by USB cable. The computer will pop up a USB flash drive and click on the URL in the USB flash drive: http://microbit.org/ to enter the programming interface. Add the Yahboom package: https://github.com/YahboomTechnology/Tiny-bitLib to program.
Mode 2 offline programming: We need to open the offline programming software. After the installation is complete, enter the programming interface, click【New Project】, add Yahboom package: https://github.com/YahboomTechnology/Tiny-bitLib, you can program.
In the picture shown below, the ultrasonic module with red wire frame.
2.Learning goal
2-1. Learn how to use compass graphically program building blocks
2-2. The function is realized by programming: When the angle of the micro:bit compass id changed, the Tiny-bit will wobble and the buzzer will sound.
3.Search for block
The following is the location of the building blocks required for this programming.









4.Combine block
Please see microbit-Wobble-when-touch.hex for the program
5.Experimental phenomena
After the program is downloaded, open the power of robot car.
1. Complete the calibration of the compass according to the method in the 【preparation.】
2. After two seconds, the micro:bit dot matrix will display heart as shown in Figure 1. Tiny-bit will stand still.
3. When we gently push Tiny-bi by our hand (changing the angle of the current compass), the micro:bit dot matrix will display the pattern of the chess board, while lights become blue, as shown in Figure 2 below. Tiny-bit will wobble for a while, then it will keep still. the micro:bit dot matrix will display heart and the lights will go out, and the buzzer will make a sound.

