2. Case 01: Running Control

2.1. Purpose


  • Learn to control the movement of TPBot via programming.

2.2. Materials


../../_images/TPBot_tianpeng_case_01_01.png

2.3. Software


MicroSoftmakecode

2.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 A

  • Drag the brick of setting the speed in both 100 for both wheels of TPBot into the “On Start”.

../../_images/TPBot_tianpeng_case_01_04.png

2.5. Conclusion


  • TPBot keeps moving forward.

##Sample B

  • Drag and set the brick of moving forward at the speed of 100 and lasting for 3 seconds into the “On Start”.

../../_images/TPBot_tianpeng_case_01_05.png

Link

---

2.6. Conclusion


  • TPBot moves forward at full speed for 3 seconds and then stops.

##Sample C

  • Drag and set the brick of moving forward at the speed of 100 into the brick of “while button A being pressed”, then set to pause for 2000ms, and drag the stops immediately brick as the pic says.

../../_images/TPBot_tianpeng_case_01_06.png

Link

---

2.7. Conclusion


  • While button A being pressed, TPBot moves forward at the full speed for two seconds and then stops.

2.8. Exploration


2.9. FAQ


2.10. Relevant File