4. Case 03: Line Tracking

4.1. Purpose


  • Programme to set the TPBot driving along with the black line.

4.2. Material


../../_images/TPBot_tianpeng_case_01_01.png

4.3. Software


MicroSoftmakecode

4.4. Programming


  • Click “Advanced” to see more choices in the MakeCode drawer.

../../_images/TPBot_tianpeng_case_01_02.png

  • We need to add a package for programming. Click “Extensions” in the bottom of the drawer and seach with “tpbot” in the dialogue box to download it.

../../_images/TPBot_tianpeng_case_01_03.png

##Sample

  • Judge the status of the line-tracking sensors: if the black was detected on the left, set the speed of the left wheel in 0 and the right in 40; if the black was detected on the right, set the speed of the left wheel in 40 and the right in 0.

../../_images/TPBot_tianpeng_case_03_04.png

4.5. Conclusion


  • TPBot drives along with the balck line.

4.6. Exploration


4.7. FAQ


4.8. Relevant File