Starting Blocks

Now that we can connect your controller we will start working on programming your CoDrone. First we will go over how to start your programs. There are two main ways we can start our programs, either by pressing the green flag in the top right corner or by pressing a key. Both of these blocks are in the control tab in the top left corner. Click on the control tab and then drag the   into the program area (big open gray space).

Now anytime we press the green flag it will run whatever code we have with this starter block. Notice the little bump below the block, we can put your program together like a puzzle. We will add a block below the starter block to test it out. Go to the Looks tab, and then drag the “Say Hello for 2 secs” block to below the starting block. Make sure to bring them close enough so that they snap together into one stack of blocks.

Then when we press the green flag in the top right corner it should display “Hello!” in the white box in the top right corner for two seconds.

Next we will learn the other type of starting block. The other one runs the program whenever the specified key is pressed. Go back to the control section and drag the “when space key pressed”  block to the program section. Then you can change which key it waits for by clicking in the word “space” on the block. It will then give you a choice of keys to choose between. We will remain using the space key. To test it we will add the “say “Hello!” for 2 secs” block below it. So now whenever we press space or click on the green flag, it should say “Hello!”.