21. Case 19: Sweeper#

21.1. Purpose#


  • Build a TPBot sweeper.

21.2. Material#


../../_images/TPBot_tianpeng_case_01_01.png

21.3. Hardware Connection#


Connect the 360 degrees servo to servo 1 port on TPBot. (Servos are not included in our TPBot kit)

../../_images/TPBot_tianpeng_case_19_03.png

21.4. Software#


MicroSoft makecode

21.5. Programming#


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

../../_images/TPBot_tianpeng_case_01_02.png

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

../../_images/TPBot_tianpeng_case_01_03.png

Sample#

  • Drag the show icon brick in the on start and set the car to move forward at the speed of 30%; in forever brick, set the servo connecting to S1 rotate to 180 degrees and pause for 1000ms, and set it rotate to 0 degree and pause for 1000ms.

../../_images/TPBot_tianpeng_case_19_04.png

Conclusion#

The car move forward with the servo rotating.

21.6. Exploration#


21.7. FAQ#


Q: The car cannot move with the code in this case?
A: It might be a lack power of the battery, please add the value of the parameter for the speed of the car and test it.

21.8. Revelant File#