8. Case 07: Here Comes the Police

8.1. Purpose


  • Programme to let the TPBot be a “police car”.

8.2. Material


../../_images/TPBot_tianpeng_case_01_01.png

8.3. Software


MicroSoftmakecode

8.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 a smile face on the micro:bit and set it moving forward at the speed of 100%.

  • Set the headlights in red and pause for 100ms in the forever brick; then set them in blue and pause for 100ms.

../../_images/TPBot_tianpeng_case_07_04.png

8.5. Conclusion


  • Power up to set the TPBot driving forward with the headlights alternating showing red and bule.

8.6. Exploration


8.7. FAQ


8.8. Relevant File