Summer Sale: 5% OFF Over $49, Code: Elephant5; 10% OFF Over $99, Code:Elephant10

Robot Kit for Micro:bit Tutorial: 6.13 Spinning top

Posted by SuFiona on

Robot Kit for Micro:bit Tutorial: 6.13 Spinning top


This course mainly uses the accelerometer that comes with micro:bit. When I hold the Tiny-bit and move it, the values of X, Y and Z in the three directions of acceleration will change.

In this experiment, we use the data be changed in the X direction.

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: to enter the programming interface. Add the Yahboom package: 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:, 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 we tilt the Tiny-bit by hand, measuring the magnitude of the data is changed in the x-axis direction of the accelerometer, and set the time of the Tiny-bit rotation based on this data.

3.Search for block

The following is the location of the building blocks required for this programming.









4.Combine block

The summary program is shown below: 


5.Experimental phenomena

After the program is downloaded, open the power of robot car, and micro:bit dot matrix will display a heart.

When we press the A button, an arrow pointing to the B button will appear as shown in Figure 1. Then we can shake Tiny-bit. We can see that the micro:bit dot matrix will display data of the x-axis will changed of the accelerometer , as shown in Figure 2 below.

Next, we need to put the Tiny-bit on the ground or on the desktop. After pressing the B button, the a butterfly will be displayed on the micro:bit dot matrix as shown in Figure 3,then Tiny-bit starts to spin right as shown in Figure 4. As shown, the spin right time is the absolute value of the accelerometer x-axis change data.

After the time is up, Tiny-bit will stop.

Until we press the A button again, shake the Tiny-bit, change the accelerometer data, and then press the B button, the Tiny-bit will spin again.

image.png     image.png      image.png

Figure 1                             Figure  2                              Figure  3

The code of the experiment: 13.Spinning top.rar

Playing with Tiny bit Microbit Robot Tutorial:


Leave a comment

Please note, comments must be approved before they are published