9. Introduction to Loops in DroneBlocks with Simulator and DroneBlocks Platform (1 Hour)

DroneBlocks Simulator Introduction

Today we will go through the DroneBlocks Simulator to help us learn about block-based coding and how we can use it to fly our drone. A simulator shows you what something will look like in real life before you do it in real life. We like to use a simulator for our drones to map out what we want to happen before we fly our drones. This helps us because we can see potential problems, and it doesn’t waste the battery on our drones. You will do a few challenges today and learn about loops in DroneBlocks.  

DroneBlocks Simulator

  1. Click here to access the DroneBlocks Simulator. 
  2. Choose to launch the “Minimal” environment and type in the month’s password: 4822 
  3. Copy the code in the picture below
  4. When ready,  choose “Launch Mission” from the dropdown menu on the right to test your simulator. 

Video Instructions

What are Loops?

Loops are an essential part of coding and used all of the time. A loop block can also be called a repeat block, too. A loop is doing something over and over again and this can be extremely helpful when writing out your coding. Today we will learn how to use a loop in the simulator. Below is the introductory video to loops and they refer to the block as a repeat but remember, they mean the same thing. After that, we will work on the simulator. 

https://www.youtube.com/watch?v=DgL1-axtxmU

Loops in the Simulator

Now we will practice loops in the simulator. Follow the steps below or watch the video to see how to add a loop to your program.

  1. Click here to access the DroneBlocks Simulator. 
  2. Choose to launch the “Minimal” environment and type in the password: 2361
  3. Copy the code in the picture below
  4. When ready,  choose “Launch Mission” from the dropdown menu on the right to test your simulator.

Loops with DroneBlocks App

We will take what we have learned and use the DroneBlocks App to test our drone. Use the code from the DroneBlocks simulator from earlier as a guide. Use the DroneBlocks app on your device and copy the code from the simulator. When you are ready and can safely fly, launch your code.