Introduction: CoDrone Mini With Blockly: Flight Events
You get to fly your drone! In this lesson, you'll learn how to program it so it can take off, stay in the air, and then land.
- CoDrone Mini, remote, and USB cable
- Computer with internet to access https://robolink.com/blockly-cdm/
- CoDrone Mini batteries and chargers
Step 1: Teacher Resources
Click here for this tutorial's lesson plan, PDFs, and more!
Step 2: Flight Events
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 Mini 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. The take off and land blocks should be at the top!
Step 3: Take Off
Any code that has your CoDrone Mini in the air will start with the take off block. This will make your drone launch from the ground and fly vertically in the air. Your CoDrone Mini should then hover for about three seconds before moving on to the next block in your code.
Let’s make your CoDrone Mini take off now! Start by dragging the take off block from the flight commands menu to your workspace.
Step 4: Hover
If you want your CoDrone Mini to hover for more than three seconds, there is a way to do that! Find the hover for _ seconds block in the flight commands menu and connect it to the bottom of the take off block. Next, type in the number of seconds you would like your CoDrone Mini to hover for.
Step 5: Land
The land block brings your CoDrone Mini to the ground gently. When you’re finished with everything else in your code, attach the land block to the bottom of your program.
Step 6: Emergency Stop
There might be times when your CoDrone Mini is about to crash into something and you need to have it land before it does serious damage. If you want your CoDrone Mini to land before crashing, you can always use the stop button in your workspace. You can also program a kill switch by dragging a rounded when _ key press block from the gray keyboard inputs menu into the workspace. This should be the block that doesn’t have a connector on the side! Pick the key you would like to use to stop your drone from the block’s drop-down menu, but as a warning, using the backspace key can sometimes delete blocks of code! We recommend using the spacebar key since it’s the easiest to find.
Next, go to the flight commands menu, find the land block, and drag it into the when _ key press block.
Note: this will be a separate program but will be in the same workspace!
Step 7: Final Code
Your workspace should look something like this:
Step 8: Challenge
Challenge: CoDrone Mini pushups
Try to make your CoDrone Mini take off and land 5 times in a row with one code! Currently your CoDrone Mini can do one pushup with the code you have.
- The CoDrone Mini must completely leave the ground on takeoff.
- The CoDrone Mini must be completely back on the ground on landing.
- Don't forget an emergency stop!
See who can do the most CoDrone Mini pushups in 10 seconds OR who can use the least amount of blocks in their code!