Tour of Crossroad | Maqueen Plus V2 Getting started Tutorial 10

0 2122 Easy

 

Standing at a crossroad, Maqueen Plus V2 is wondering which way he should go. Every road is so unique. Well, why not try all the roads? That sounds like a good idea, right? Let's help Maqueen Plus V2 to start his tour of the crossroads!


Goal

Learn the use of multiple line-tracking sensors

Hands-on Practice

Step 1 Create a New Project

1. Input https://makecode.microbit.org/ into your browser to enter the MakeCode editor.

2. Click "new project" to enter the MakeCode programming interface.

Add the Maqueen Plus V2 library: https://github.com/DFRobot/pxt-DFRobot_MaqueenPlus_v20

Step 2 Programming

1. In this project, we need to prepare a crossroad map. Maqueen Plus V2 will try all roads of the crossroad, and then back to the starting point. How can we realize that by programming? In the process of line-tracking, Maqueen Plus V2 turns left/right at the intersection, and then turns around at the end of the road. Repeat this series of actions all the time.

2. First, complete the program of line-tracking.

3. When no black line is detected by sensors L1 and R1, it means that the car drives out of the black track. Now let the Maqueen Plus V2 spin around until the black track is found again.

4. When the sensors L2 and R2 detected the black line, it means that the car has arrived at the intersection or the end of the road, and the car needs to spin around to find the black track again.

5. The complete program is shown below.

6. Name your project "Tour of crossroad" and save it.

Step 3 Download Program

Step 4 Effect Display

When you completed all the steps, put Maqueen Plus V2 on the crossroad map, and turn on its power switch.

Think & Explore

When Maqueen Plus V2 arrives at the intersection, he will turn right, well, now let's make its right RGB LED flash while turning right, and both RGB LEDs flash before turning around.

Tip: add RGB blocks in the program above.

 

Click Buy micro:Maqueen Plus V2 (Ni MH Rechargeable Battery) - an Advanced STEM Education Robot for micro:bit - DFRobot

Click Buy micro:Maqueen Plus V2 (18650 Battery) - an Advanced STEM Education Robot for micro:bit - DFRobot

Engage in learning the next Robot project:IR-controlled Robot

Engage in learning the previous Robot project :  Line-tracking Robot

 

License
All Rights
Reserved
licensBg
0