CODE

 

INTRODUCTION

In this lesson, students gain an understanding of programming and coding.  Through the introduction and use of block-based coding, students will design, compile, and execute code to navigate the Parrot Mambo Drone.

 

PROGRAMMING THE MAMBO DRONE

Algorithm?

In order to understand computer programming, it is first essential to understand the definition of an algorithm.

 

“A well defined step-by-step series of instructions that solve a problem.”

 
 

Recipe = Algorithm

A recipe is a great example of an algorithm. 

 

After following a recipe, the results will be an exact outcome.

Solve the Problem

In computer programming, the first step is to identify the “problem”. 

 

The second and final step is to create a series of commands to solve that “problem”. 

 

Creating the series of commands is called Programming, the actual series of commands is called Code.

 

Problem:

Program the drone to take off, hover, flip forward and then land.

 

Solution:

1_edited.png
 

Programming vs. Code

Programming is the action of arranging commands in an intentional sequence to solve a problem.

 

Programming creates Code.

 

Code = the solution to the problem

 

Problem:

Program the drone to take off, hover, flip forward and then land.

 

Solution:

1_edited.png
 

FTWCODE - PROGRAMMING PLATFORM

 

FTWCODE can be accessed at: www.ftwcode.com

 

This lesson uses FTWCODE to create code, and to connect to and navigate the Parrot Mambo Drone.

Block-Based Coding - FTWCODE

Block-based programming in FTWCODE features a drag-and-drop capability. Blocks are snapped and stacked on top of each other to form actions.

 

Blocks can be dragged and rearranged, and include common functions found in most programming languages.

 
 

Types of Blocks - FTWCODE

Closed Blocks - The “Program Start” block and the “Functions” blocks are the only blocks that are considered Closed Blocks. Blocks can be placed inside of them but they cannot be placed inside of any other blocks.

2_edited.png
3_edited.png
 

Snap Blocks - FTWCODE

Snap blocks are any type of block that can be placed inside of a Closed Block. Snap Blocks often feature selectable elements.

4_edited.png

Building Code - FTWCODE

Blocks are only considered active when they are solid in color. “Program Start” is always active and will always be solid.

5_edited.png

Blocks are only considered active when they are solid in color. “Program Start” is always active and will always be solid.

6_edited.png
 
 

“Program Start” - FTWCODE

FTWCODE uses “Program Start” as the initial command (pictured below).

 

To start programming, select the General category. This will expand the General category available block set. Then, drag the “Program Start” block onto the work area.

Programming in FTWCODE

After “Program Start”, each command needed is added in the order necessary to solve the problem and complete the code.

 

Problem:

Program the drone to take off, hover, flip forward and then land.

 

Solution:

8_edited.png
 
 

Connecting to the Mambo - FTWCODE

Enable the computer’s Bluetooth function (desktop, laptop or Chromebook). 

 

Open Google Chrome™.

 

Copy the shared link below and paste into a Google Chrome browser: 

 

https://www.ftwcode.com
 

Select Drone in the upper left-hand corner.

 

Select Connect to bring up the pairing window.

 

Select your individual drone which is identified by its unique six (6) digit serial number. (This number follows the prefix Mambo_.)

 

Click on “Pair”.

 

Drone will be connected and its current battery level will be displayed.

DEMONSTRATIONS

 

Demonstration - “Take Off Test”

Program the drone to take off, and then land.

 
 

“Earn Your Props” - Activity 3/Challenge 1

Take off, flip forward, hover, flip backward, hover, and then land.

10_edited.png
11_edited.png
 

“Earn Your Props” - Activity 3/Challenge 2

Take off, rotate in a complete circle 3 times, and then land.

12_edited.png

“Earn Your Props” - Activity 3/Challenge 3

Take off, move forward for 1 second @ 100% power, and then land.

13_edited.png
 

“Earn Your Props” - Activity 3/Challenge 4

Take off, move forward 4 feet and then land.

 

REMINDER: In programming there is usually more than one potential solution, and solutions can vary slightly from drone to drone.

14_edited.png
15_edited.png
16_edited.png
 

“Earn Your Props” - Activity 3/Challenge 5

Fly once (1x) around a 4’x4’ square.

 

HINT 1: Use tape, string, chalk or other method to mark the route in advance. 

HINT 2: Experimentation will help get the distances correct.

17_edited.png
18_edited.png
 

“Earn Your Props” - Activity 3/Challenge 6

Fly THREE (3) times around a 4’x4’ square using only the commands in the “Mini Drone” block set.

 

REMINDER: Besides there being multiple solutions, each individual drone may require slightly different power levels and/or fly time to achieve the correct distances.

19_edited.png
 
 

Creating Loops - Important Skill

A Loop is a programming command that directs the code it covers to repeat until certain conditions are met.

 

Loops are helpful because they allow programmers to save time when needing commands to repeat, allowing for more efficient programming.

 

The Loops command is found in the Loops dropdown menu.

20_edited.png

Loops - Patterns and Efficiency

Loops are essential to create efficient code.

 

Loops take repeating patterns in code and simplify them by using multipliers to repeat code.

 

The next TWO challenges require the use of Loops!

 

“Earn Your Props” - Activity 3/Challenge 7

Fly FIVE (5) times around the same square path as in Challenge 6, but this time use the command Loops in FTWCODE.

 

HINT: Create code that will navigate around the square 1x, drop that code into a Loop and set the Loop to repeat the command 5x.

 

REMINDER: Besides there being multiple solutions, each individual drone may require slightly different power levels and/or fly time to achieve the correct distances.

21_edited.png
22_edited.png
 

“Earn Your Props” - Activity 3/Challenge 8

Fly FIVE (5) times around an 8’x4’ rectangle using the shortest amount of code possible.
 

REMINDER: Besides there being multiple solutions, each individual drone may require slightly different power levels and/or fly time to achieve the correct distances.

23_edited.png
 

“Earn Your Props” - Activity 3/FREESTYLE

Program a custom :15 to :30 second flight path that demonstrates a high level of programming skills and technique.

 

The goal of this challenge is to have fun and FREESTYLE, develop an innovative, creative code that commands the drone to do something entertaining.

 

Students shall create an original video of a drone completing the flight path they have created.

mambofeet.png
 

TERMS AND DEFINITIONS

 

Syntax


A set of rules that defines what the various combinations of symbols mean.




Console


The interface between a monitor and a keyboard where the monitor provides the output and the keyboard serves as the input.




Code


Code is a term used to describe text that is written using the protocol of a particular language by a computer programmer.




Pairing


A process used in computer networking that establishes a communication linkage between computing devices.




Javascript


A programming language commonly used in web development as a means to add dynamic and interactive elements to websites.




Python


Python is considered a scripting language and is often used for creating Web applications and dynamic Web content.




Logic


Logic programming is a computer programming paradigm where program statements express facts and rules about problems within a system of formal logic. Rules are written as logical clauses with a head and a body; for instance, "H is true if B1, B2, and B3 are true."




Math


Math, in programming terms, is the use of mathematical models to assist in making decisions.




Variables


Variables are names used to hold one or more values and they work like containers to hold numbers, phrases, or other important information.




Functions


A function is a block of organized, reusable code that is used to perform a specific action.