Snap Lesson 2: Flight Events
Here we will learn how to get the CoDrone off the ground and into the skies

Scene_07 [1]

Summary

Now that we know how to setup and pair our drone, we can begin programming our very first flight code.  Here we will learn how to use the TakeOff and Landing flight events, as well as the wait block.

Flight Event

  • Sends the event to the CoDrone
  • Events are often short maneuvers such as TakeOff, Landing, and Stop

  • It will startup the motors and bring the CoDrone to a hover just above the ground.

  • This will cause our CoDrone to gently land.

TakeOff Landing

Lets start by having the CoDrone to take off when we press the green flag.


Also if you need to stop your CoDrone while it is flying click on “stop”.
However, if we just put the two functions right after each other, our CoDrone will TakeOff and Land in a split second and we probably won’t even notice it happening.  Sending commands too quickly to the CoDrone can also result in some commands being skipped.

To prevent this, we use a wait block.

 

Wait

  • delays the code for the amount of seconds indicated
  • The code will be frozen at the current line for the entirety of the delay

In our example we use , which means our code will wait for 2 seconds before moving on to the next line.  This gives the TakeOff maneuver 2 seconds to complete before the CoDrone lands.  We’ll put this between our TakeOff and Landing:
TakeOff Landing Delay

Activity: Push-Ups

Try to make your CoDrone takeoff and land 3 times in row with one code.

Rules:

  1. The CoDrone must leave the ground completely during TakeOff
  2. The CoDrone must have all four arms on the ground during Landing
  3. There is no height requirement for how high the CoDrone flies.

See who can do the most CoDrone push-ups in 10 seconds!

In Flight Part II, we will learn how to make our CoDrone move using Throttle, Yaw, Pitch and Roll.