11. Case 10: Fall-arrest TPBot

11.1. Purpose


  • Stick a black gummed paper to the edges of the table, programme to set the TPBot reversing if the black was detected and then it keeps moving forward.

11.2. Material


../../_images/TPBot_tianpeng_case_01_01.png

11.3. Software


MicroSoftmakecode

11.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

  • Set an icon on the micro:bit display and the headlights in white.

  • Judge if the black line was detected in the forever brick, if yes, set the TPBot reversing for one second at the speed of 30% and then turning left for 0.5 second at the same speed; or it moves forward at the speed of 30%.

../../_images/TPBot_tianpeng_case_10_04.png

11.5. Conclusion


  • Power up to show an icon on the micro:bit display and set the TPBot moving forward with headlights in white. If the black line was detected, it reverses and then turns left to keep moving.

11.6. Exploration


11.7. FAQ


11.8. Relevant File