1.2: Flight Events

Make sure that your drone is connected with Blockly before starting the lesson! If you are unsure of how to connect, go back to the first lesson to review!

Out of all of the menus in Blockly, the one you will be using the most is Flight Commands. This is where you will find blocks to have your CoDrone EDU fly in different directions and, probably most important, take off and land! To find the take off and land blocks, click on the dark blue flight commands menu.
Any code that has your CoDrone EDU in the air will start with the takeoff block. This will make your drone launch from the ground. Don’t worry about your drone flying straight into the ceiling! CoDrone EDU uses the height sensor to fly about a meter off of the ground. Then, it will hover automatically and wait for the next command.

Drag the takeoff block from the flight commands menu to your workspace.The land block brings your CoDrone EDU to the ground gently. When you’re finished with everything else in your code, attach the land block to the bottom of your program. If you want your CoDrone EDU to hover for more time before landing, you can use the hover block from the flight commands menu and connect it after takeoff. Don’t forget to type in the number of seconds you would like your CoDrone EDU to hover for before landing.Using the hover command is one way to make your program pause for a duration in seconds. You can also use a wait block, found in the grey “Timing” category. This block will pause your program. No other commands will be sent until the delay finishes.Replace the hover block with a wait block for 4 seconds. What do you observe?There might be times when your CoDrone EDU is about to crash into something and you need to have it land before it does serious damage. If you want your CoDrone EDU to land before crashing, you can always use the stop button in your workspace. You can also use the “emergency stop” block. Try replacing the land command with the “emergency stop” command and see what happens. However, we always recommend using the “land” block whenever possible if you want to protect your drone from damage.Challenge: CoDrone EDU Pushups 

Try to make your CoDrone EDU take off and land 3 times in a row with one code! Currently, your CoDrone EDU can do one pushup with the code you have.
Rules
1. The CoDrone EDU must completely leave the ground on takeoff.
2. The CoDrone EDU must be completely back on the ground on landing.
3. You must include a hover command between takeoff and landing.

Congratulations! You’ve learned all about how to use the CoDrone EDU’s basic flight commands. Before moving on to the next lesson, let’s review some of the blocks that you learned about in this lesson:

  • Takeoff
  • Land
  • Hover
  • Emergency Stop