Lesson Plan

Lesson: Fly by Feel
Time: 40+ mins

Introduction

In this lesson, students will learn how to use tilt blocks to control their drone as they complete 3 DIY (do-it-yourself) projects. Students are also introduced to conditions and conditional statements. A condition is something we can check if it is true or false. For example, we can check if the drone is tilted. If the drone is tilted, the condition is true. Otherwise, the condition is false. A conditional statement gives certain instructions when certain conditions are true. In today's coding adventure, students will be using "if-then" and "if-else" statements to control the drone. Important: This lesson has 3 DIY projects that require at least one Parrot drone.

New Code Blocks

  • : If the condition is true, then run the code inside this block.
  • : If the condition is true, then run the code inside the "if" section. Otherwise, run the code inside the "else" section.
  • : Return how steep the device is tilted.
  • : Return the angle which the device is tilted.
  • : Return how much the device is tilted horizontally.
  • : Return how much the device is tilted vertically.
  • : Make the drone perform a flip in the air.

Vocabulary

  • Condition: A logical expression that evaluates to true or false.
  • Conditional statement: A type of statement that executes different parts of the code based on whether a logical expression evaluates to true or false.
  • Absolute Value: The absolute value of a number is its distance from 0. This means that -2 and 2 both have an absolute value of 2 because they’re both 2 units from 0. To find a number’s absolute value, remove the negative sign from any negative numbers. The absolute value of a positive value is itself.

Objectives

Students will...
  • Apply coding concepts to check what direction a tablet is tilted
  • Use conditional statements
  • Use code blocks to create 3 projects

Materials

  • Parrot drone (minimum 1 per class)
  • For web: Computers, laptops, or Chromebooks (1 per student)
  • For mobile: iPads or Android tablets (1 per student)

Warm-Up (5 minutes)

Explain to students that "if-else" statements execute one group of commands if something (a condition) is true. Otherwise, it executes the commands inside the "else" case. Next ask them to write 3-5 real-world examples of "if-else" statements. See if they can make their statements drone related. If students are struggling, here are some prompts to help them get started:
  • If you do not attach a "land" block to the drone Actor's script, then the drone will…
  • If the drone isn't connected to the device, then…otherwise…
  • If the drone runs out of batteries, then...otherwise…

Activities (40+ minutes)

Facilitate as students complete the Fly by Feel modules on their own:
1. Concepts (Concept)
  • Students are introduced to the tilt code blocks. They can use these blocks to detect whether their tablet is tilted, in what direction it is tilted, and how far it is tilted.
  • The "tilt amount" block holds a decimal between 0 and 1. When the device is perfectly flat, the "tilt amount" is 0. When the device is tilted as much as possible, the "tilt amount" 1.
  • Point out that the "tilt amount" block doesn't detect which direction the device is tilted, only how far it is tilted. Explain to students that if they tilt their device forward, then tilt their device the same amount backwards, the block will have the same value!
  • Explain to students that the "tilt angle" lets the user know what direction the tablet is tilted. However, it doesn’t tell you that the tablet is tilted "up" or "down". Instead, it tells you the angle in degrees from -179 to 180, where 0 is to the right.
  • Students are also introduced to the "x tilt" and "y tilt" blocks. Make sure students know the "x tilt" block detects how steeply the user tilted the device to the left or right. The "y tilt" block detects how steeply the user tilted the device up or down.
  • Reinforce how the "x tilt" block works by telling students…
    • When the device is tilted all the way to the left, the value will be -1
    • When the device is tilted all the way to the left, the value will be 1
    • If the tablet is not tilted left or right, the value is 0.
  • Check for understanding by asking students what the value of the "x tilt" block will be if they tilted the tablet forward but not left or right. (Answer: 0, this is because the "x tilt" block doesn't know if the tablet has been tilted forward or backward. It only detects if it is tilted left or right.)
  • Inform students that the "y tilt" block tells them the same thing as the "x tilt" block, except for a backward and forward tilt. For example…
    • When the device is tilted all the way forward, the value will be 1
    • When the device is tilted all the way backward, the value will be -1
    • If the tablet is not tilted backward or forward, the value is 0.
  • Another very important concept that students learn is conditionals. Conditionals check whether a condition is true or false. The "if-then" code block will only run the code inside it if the condition is true.
  • Explain to students that a conditional can check different things, such as: whether the drone is tilted, if it’s tilted more than halfway, if a variable is equal to a certain value, etc.
2. Flipping Tablets (DIY)
  • In this DIY (do-it-yourself) project, students will learn how to program a drone to flip left or right depending on the x-tilt of their device!
  • Coding activities include programming the drone to take off, using conditionals, making the drone flip, landing the drone, and experimenting with different ways to make the drone flip.
  • Check for understanding by asking students, "True or false: A negative x tilt means that the device is tilted to the left." (Answer: True)
  • Remind students that the "forever" loop will keep repeating the code inside it until the program stops. Ask them what would happen if they just put the "if-then" block and didn't put it inside a "forever" loop. (Answer: The program would not repeatedly check if the tablet is tilted. It would only check it one time. Using a "forever" loop makes the program check the tilt forever!)
  • Students are introduced to the "if-else" conditional, which is slightly different than the one they were introduced to in the concepts module. Unlike the "if-then" conditional, the "if-else" conditional allows students to check more than one condition. Students can add additional branches to the "if-else" block by clicking the plus sign that looks like this:

  • The last page of the tutorial encourages students to try using the "y tilt" code block to make the drone tilt forward or backward.
3. Trick Panel (DIY)
  • In this project, students will learn how to program their drone to move left, right, forward, or backward depending on the tilt of their device.
  • Coding activities include programming the drone to take off; setting the tilt axis; creating conditions to make the drone fly left, forward, right, or backwards; programming the drone to land, and customizing the project.
  • Inform students that they only need to move the drone left, forward, right, or backwards--not left-right. This is why they have to choose one of these four directions every time they want to move the drone.
  • Discuss with students why they need to take the absolute value of the tilts. For example, taking the absolute value ignores whether the x tilt or y titl is positive or negative. This also allows the program to compare whether the magnitude (absolute value) of the x-tilt or the y-tilt is larger.
  • The last page of the tutorial instructs students to explore different ways to determine the drone's direction.
4. Tilt Controller Revisited (DIY)
  • This project expands on the previous project: Tilt Controller. Students will need to modify this project to speed up or slow down the drone based on how far their device is tilted.
  • Coding activities include creating a "dead zone" where the drone won't fly if the device is barely tilted, changing the drone's speed, and adjusting the tilt sensitivity.
  • Remind students that the "tilt amount" can have any value between 0 to 1. Also remind students that the drone can be set to any speed percentage from 0% to 100%.
  • Check for understanding by asking students why they need to multiply the tilt amount by 100. (Answer: Multiplying the tilt amount by 100 will always give a value between 0 and 100).
5. Quiz (Multiple Choice)
  • Students will be asked multiple-choice quiz questions to review concepts from this lesson.

Extended Activities

Review today’s coding adventure by leading a discussion. Ask students:
  • Who can give a real-world example of a conditional statement?
  • How did you apply tilt code blocks in today's lesson?
  • How else can you apply tilt code blocks to create a project or game in Tynker?

Standards

U.S. Standards
  • CCSS-ELA: SL.5.1, 6-8.RST.3, 6-8.RST.4, 6-8.RST.7, RI.7.4, RI.8.4
  • CCSS-Math: MP.1
  • CSTA: 1B-CS-02, 1B-CS-03, 1B-AP-11, 1B-AP-12, 1B-AP-15, 2-CS-02, 2-CS-03, 2-AP-10, 2-AP-11, 2-AP-13, 2-AP-14, 2-AP-15, 2-AP-16
  • CS CA: 3-5.AP.10, 3-5.AP.13, 3-5.AP.14, 3-5.AP.17, 3-5.CS.2, 3-5.CS.3, 6-8.CS.2, 6-8.AP.13, 6-8.AP.16, 6-8.CS.2, 6-8.CS.3
  • ISTE: 1.c, 1.d, 4.d, 5.c, 5.d, 6.b

U.K. Standards
National Curriculum in England (computing):
Key Stage 2 (Years 4-6)
  • Design, write and debug programs that accomplish specific goals, including controlling or simulating physical systems; solve problems by decomposing them into smaller parts
  • Use logical reasoning to explain how some simple algorithms work and to detect and correct errors in algorithms and programs
  • Understand computer networks, including the internet; how they can provide multiple services, such as the World Wide Web, and the opportunities they offer for communication and collaboration
  • Use technology safely, respectfully and responsibly; recognise acceptable/unacceptable behaviour; identify a range of ways to report concerns about content and contact
This course is not part of your plan. Please upgrade to view all answer keys

Class Presentations

These student-facing slide presentations help educators seamlessly run Tynker lessons in a virtual or physical classroom setting. Each lesson has its own set of slides that introduce the big ideas, suggest unplugged activities, and include a section for each activity module. While running lesson slides, you can switch back and forth between the activity, the slides, answer keys and other lesson materials.
A sample slide presentation is available for your review. Please log in to view all the class presentations available with your plan..
Lesson 1
Flight Training
0 Slides
Lesson 2
Aerobatics
0 Slides
Lesson 3
Pilot's Wings
0 Slides
Lesson 4
Dronie
0 Slides
Lesson 5
Skywriting
0 Slides
Lesson 6
Remote Control
0 Slides
Lesson 7
Fly by Feel
0 Slides
Lesson 8
Advanced Movement
0 Slides
Lesson 9
Virtual Pilot
0 Slides
Lesson 10
Virtual Pilot 2
0 Slides
Lesson 11
Grabber and Cannon
0 Slides