8. Case 06: Drive at Random#

8.1. Purpose#

  • Programme to set the TPBot driving at random.

8.2. Material#


8.3. Software#


8.4. Programming#

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


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



  • Set a smile face on the micro:bit.

  • Set the speed of the left and the right wheel at a random value between -100~100 and pause 2 seconds.



  • The micro:bit shows a smile face and the speed of both wheels changes every two seconds at random.

8.5. Exploration#

8.6. FAQ#

8.7. Relevant File#