19. Case17:Gesture-controlled TPBot

19.1. Purpose


  • Control the movement(forward, back, turn left/right) by your hands gesture.

19.2. Material

1 x TPBot

../../_images/TPBot_tianpeng_case_01_01.png

19.3. Hardware connection

Connect gesture sensor to IIC port on TPBot.

../../_images/TPBot_tianpeng_case_17_03.png

19.4. Software


MicroSoftmakecode

19.5. 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 search with “tpbot” in the dialogue box to download it.

../../_images/TPBot_tianpeng_case_01_03.png

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

../../_images/TPBot_tianpeng_case_15_03.png

19.6. Sample

  • Drag the show icon brick into on start.

  • Detect the hands gesture through the gesture sensor, set the car to move forward at the speed of 40% for 1s while detecting your hand waving upward.

  • Code with a similar way for the gesture of waving downward, left and right.

../../_images/TPBot_tianpeng_case_17_04.png

19.7. Conclusion


  • Face your hands onto the gesture sensor, control TPBot’s movement with your hands gesture.

19.8. Exploration


19.9. FAQ


Q: While operating this case, why the car might not work properly?

A: It might be the low power of the batteries, please try adding the value of TPBot’s speed and test again.

19.10. Relevant File