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



Robot Kit for Micro:bit Tutorial 6.6 Playing black paino

Posted by SuFiona on

Robot Kit for Micro:bit Tutorial 6.6 Playing black paino

!Note:In order to avoid the interference of sunlight on infrared sensor, we need to carry out this experiment indoors.


1.Preparation

1-1.The position of the tracking sensor module in the robot 

In the picture shown below, the tracking module with red wire frame

image.png

1-2 Learn about the principle of tracking module

 

The basic principle of the tracking sensor is to use the reflective nature of the object. 

Our experiment is to tracking the black line. When the infrared light is emitted to the black line, it will be absorbed by the black line. When the infrared light is emitted to the other color line, it will reflected to the infrared receiver tube. 

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 line sensor graphically program building blocks and control motor graphically program building blocks

2-2.The function is realized by programming: while the Tiny-bit is moving forward on the white bottom surface, the line sensor detects black, it lights up red and the buzzer plays different tones.

3.Search for block

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

image.png

image.png

image.png

image.png

image.png

image.png

4.Combine block

The summary program is shown below:

image.png

image.png

image.png

Note: The speed and time parameters in the program can be adjusted according to the actual situation.

5.Experimental phenomena 

After the program is downloaded, we put the Tiny-bit on the field with 7 black squares on the white background, open the power or the robot car, Tiny-bit will advance, the micro:bit dot matrix will display a forward arrow. And the RGB searching light is white. 

When the line sensor detects black, the RGB searching light will become red, the buzzer paly different tones, and the micro:bit dot matrix displays numbers.

When the black square is detected for the first time, the micro:bit dot matrix will display "1", the buzzer will play“do”

When the black square is detected for the second time, the micro:bit dot matrix will display "2", the buzzer will play “re”

When the black square is detected for the third time, the micro:bit dot matrix will display "3", the buzzer will play “mi”

.....

When the black square is detected for the seventh time, the micro:bit dot matrix will display "7", the buzzer will play “si”

When the black square is detected for the eighth time, the micro:bit dot matrix will display "1", the buzzer will play “do”

.......

Tip: Not necessarily black squares, you can use black pens to draw black blocks of various shapes.

The code of the experiment: 6.Playing black paino.rar

Playing with Tiny bit Microbit Robot Tutorial:

0 comments

Leave a comment

Please note, comments must be approved before they are published