Spring Sale: 5% OFF Over $89, Code: Elephant5; 10% OFF Over $149, Code:Elephant10



Robot Kit for Micro:bit Tutorial: 6.15 Adventure car

Posted by SuFiona on

Robot Kit for Micro:bit Tutorial: 6.15 Adventure car

1.Preparation

This course is mainly based on the accelerometer that comes with micro:bit.

When we rotate the micro:bit around the x-axis, that is, when rotating on the yoz plane, the degree of the rotation (picth) will be changed.

When we rotate the micro:bit around the y-axis, that is, when rotating on the xoz plane, the degree of the rotation (roll) will be changed.

When we rotate the micro:bit around the z-axis, that is, when rotating on the yoz plane, the degree of the rotation (yaw) will be changed.

In this experiment, we use the rotation angle to judge.

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/lzty634158/Tiny-bit 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/lzty634158/Tiny-bit, you can program. 

In the picture shown below, the ultrasonic module with red wire frame.

2.Learning goal

2-1. Learn how to use accelerometer graphically program building blocks 

2-2.The function is realized by programming:  Tiny-bit advances for one second, stops for one second, during the stop to detect whether the current position is flat, if it is flat, it will continue to advance, if it encounters a slope, it will back or rotate to leave the hillside and change the direction of advance.

3.Search for block

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

image.pngimage.png

image.pngimage.pngimage.png

4.Combine block

The summary program is shown below: 

image.png

image.png

image.png

5.Experimental phenomena

 

After the program is downloaded, open the power of the car. Tiny-bit will advance one second, stop one second, check if it is currently on the slope, and if it is flat, move on.If the slope is directly in front, Tiny-bit will back, then spin left to leave the hillside and look for the flat; if the slope is on the right, Tiny-bit turns left, leaves the hillside, looking for the flat; if the slope is on the left, Tiny-bit turn right, leave the hillside, look for the flat...

When moving forward, the micro:bit dot matrix displays the forward arrow. 

When it is still, the micro:bit dot matrix display scattered points.

If the slope is directly in front, the micro:bit dot matrix displays the backward arrow;

if the slope is on the right side ,the micro:bit dot matrix displays the arrow to the left; 

if the slope is on the left side, the micro:bit dot matrix displays the arrow to the right.

The code of the experiment: 15.Adventure car.rar

Playing with Tiny bit Microbit Robot Tutorial:

0 comments

Leave a comment

Please note, comments must be approved before they are published