Air vehicles move a little differently than land vehicles. While land vehicles can move forward, backward, and sometimes side-to-side, air vehicles can do all of that and move up and down! There are two blocks in the flight commands menu in Blockly that can help you program your CoDrone to fly in any of these directions.One of the blocks you can use will make your drone move in the direction you pick for a certain amount of time. All you need to do is drag the go _ for _ seconds block from the flight commands menu to your workspace, pick your direction from the drop-down menu, and then type in the seconds you want your CoDrone to travel for. The default power for this block is set to 50%, which means that it will fly at 50% of the CoDrone’s full speed.If you know how fast (or slow!) you want your CoDrone to go, you can use a different block! Select the go _ for _ seconds at _ % power from the flight commands menu, and then use the drop-down menu to pick your CoDrone’s direction. Type in your CoDrone’s flight time as well as the power value. This number can range from 0 to 100, with 0 being completely still and 100 being very fast. We recommend starting at 50 and seeing what you need to do from there.In addition to being able to fly up, down, left, right, forward, and backward, your CoDrone can also turn left and right! There are blocks in the flight commands menu that can help you program your CoDrone to do this: To use the turn _ for _ seconds at _ % power block, drag it to your workspace, and then pick left or right from the drop-down menu. Type in the number of seconds you would like your CoDrone to turn for, and then type in the power value. This number can range from 0 to 100, with 0 being completely still and 100 being very fast. We recommend starting at 50 and seeing what you need to do from there.If you want your CoDrone to turn 180 degrees, there is a block specifically designed for that! Drag the turn 180 degrees block to have your CoDrone turn 180 degrees clockwise. The default power for this block is set to 50%.Try writing a program that will have your CoDrone take off, fly forward, and then turn before landing! It could look something like this:Challenge: Shapeshifter
Have your CoDrone fly in a shape using all of the commands you just learned! The only rule is that you HAVE to include a kill switch.
Some helpful hints:
- A triangle’s angles add up to 180 degrees.
- A quadrilateral’s angles add up to 360 degrees.
- A pentagon’s angles add up to 540 degrees.
- A hexagon’s angles add up to 720 degrees.
- An octagon’s angles add up to 1080 degrees.