This mission is to fly the CoDrone from one location to another, but the user will need to time their movements with the cycle of directions. As they are flying, a program is cycling through the directions the CoDrone will move. Every time they press a key, the CoDrone will move in the direction that program selected.

We can move the CoDrone in four main directions, pitch forward, pitch backwards, roll right, and roll left. So we will need to create a program that will cycle through 4 options forever and to give us an idea of which one it is doing, we will have it play a different sound each time.

This program will do that part.

At the start it sets Choice to 0. Each time through the loop it adds 1 to Choice. Once it is greater than 4 it sets it back to 1.


Loop number Choice after change by 1 Choice > 4 Choice after if statement


1 false 1


2 false 2
Third 3 false



4 false 4
Fifth 5 true


Sixth 2 false



This lets the Choice go from 1 to 4 and keeps cycling through. If you want to know more about variables check out our variables lesson. The play note command (located under the sound tab) has two purposes pas viagra. Firstly it allows the user to have an idea of which direction if is going to move. Secondly it slows down the loop so that it will be on each choice for half a second, this way the user has some time to select the movement.

Now we need to create the loop that actually moves the CoDrone. To allow the use to control the height of the CoDrone, we will add in manual throttle control (see lesson 3).

Then we will add in the check to see if the direction button was pressed, I will be using the 1 key. Once it is pressed we need to have it move in the Choice direction for 1 second. I have Choice 1 as forward, Choice 2 as backwards, Choice 3 as right, and Choice 4 as left.

Try it Out: Try to land the CoDrone in a target area. For extra challenge lower the time in the play note so that it will change choices faster. You can also add in more choices, maybe throttle should also be choice.