Line-tracking Robot | Maqueen Plus V2 Getting started Tutorial 09

1 3784 Easy

Our line-tracking robot is fond of exploring things with a map. No matter how complicated the road is, give him a long enough track, he will trace it to the end of the world. Let's step on an adventure with the Maqueen Plus V2 robot!

 Goal

1. Learn the principle of the line-tracking sensor

2. Learn the logic "and"

Electronic Component

Command Learning

How does a line-tracking sensor work?

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

Maqueen Plus V2 moves along the black line on the map. If you don't have a map, you can make one using black adhesive tape. (Line-tracking Sensor R1, L1 and M will be used in this project.)

1. There are three possibilities when Maqueen Plus V2 drives on the map.

2. Draw the corresponding program flowchart.

3. Since there are two conditions to judge, the outputs from sensor R1 and L1, we need to use a "and" block to combine them.

4. When sensor M detected the black line, Maqueen Plus V2 car moves forward.

5. When only the right sensor (R1) detected the black line, Maqueen Plus V2 car turns right.

6. When only the left sensor (L1) detected the black line, Maqueen Plus V2 car turns left.

7. The complete program is shown below:

8. Name your project as "Line-tracking Robot" and save it.

Step 3 Download Program

Step 4 Effect Display

Turn on the power switch after all the above steps are done, put Maqueen Plus V2 car on the map, then it will automatically move along the black line, just like a track train!

Extension-Sensor Calibration

The line-tracking sensors on Maqueen Plus V2 can be directly used since they are factory calibrated. But if you find that your sensors cannot detect black line accurately, you can calibrate them in the way shown below:

Think & Explore

With the development of technology, sweeping robot is gradually becoming a part of our family life. Simply place it on the floor and turn it on, here it goes! To prevent the robot from falling off the stairs, the bottom of the robot usually is surrounded by many sensors. Our Maqueen Plus V2 has 5 line-tracking sensors, so it can totally meet the requirements. Let's make a sweeping robot with Maqueen Plus V2. Take the black line on the map as the edge of the stairs, and the robot will be only allowed to move within that area.

 

 

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:Tour of Crossroad

Engage in learning the previous Robot project :  Auto-braking Robot

 

 

License
All Rights
Reserved
licensBg
1