6. Case 02: Fly Foursquare#

6.1. Introduction#


  • Program to take off the drone and fly foursquare, then it lands on the ground.

6.3. Picture#


../../_images/Drone-bit-02.png

6.4. Software Programming#


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

../../_images/Drone-bit-case-01-01.png

For programming, we need to add a package: click “Extensions” at the bottom of the MakeCode drawer and search with “https://github.com/elecfreaks/pxt-Dronebit” in the dialogue box to download it.

../../_images/Drone-bit-case-01-02.png

Notice: If you met a tip indicating that some codebases would be deleted due to incompatibility, you may continue as the tips say or create a new project in the menu.

6.5. Program#


../../_images/Drone-bit-case-02-03.png

Notice: It is suggested to pause for 2 seconds or longer after triggering the take-off command to make sure the operator run away from the drones in case of any hurting accidents.

Link: https://makecode.microbit.org/_fdy88DiaVX9X

You can also download it directly:

6.6. Result#


  • After taking off, the drone flys forward for 100cm, then flys to the right for 100cm, and backward for another 100cm, then to left for 100cm and finally lands on the groud.