10. Case 09: Seeking light

10.1. Purpose


  • Programme to set the TPBot heading to the light.

10.2. Material


../../_images/TPBot_tianpeng_case_01_01.png

10.3. Software


MicroSoftmakecode

10.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 the headlights in white in the on start brick.

  • Judge if the light intensity is over the set point in the forever brick, if yes, set the TPBot moving forward; or it goes around in circles.

../../_images/TPBot_tianpeng_case_09_04.png

10.5. Conclusion


  • Power up to set the TPBot going around in circles or moving forward if the detected light intensity is over the set point.

10.6. Exploration


10.7. FAQ


10.8. Relevant File