Lesson: Virtual Pilot 2
Time: 40+ mins
IntroductionIn this lesson, students will learn about variables. Variables store a value (or piece of information) and can be set, changed, and compared against to create more advanced programs. Examples of a value include a number, name, or a state (on/off). Students will explore this concept further as they use variables to complete 2 fun DIY (do-it-yourself) projects: Enable Tilt Controls and Virtual Flight Plan 2. Important: This lesson has 2 DIY projects that require at least one Parrot drone.
New Code Blocks
: Adjust the value of the variable. The first parameter indicates the name of the variable, and the second parameter assigns a value.
- Variables: A value or piece of information that is stored and can be changed.
- Create and use variables
- Change and set the value of a variable
- Apply coding concepts to create 2 projects
- 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)Tell students that a variable is a value that's stored by a computer program. Model this concept by asking students to complete the following:
- Draw a container or box that has the word "age" on it. Next, write their age (e.g., 12) inside the box.
- Explain that variables are used to store information. Here's an example that illustrates a variable named "age" that's assigned (storing) the value "12":
Here's what it'll look like using the "set" code block:
- Inform students that the first parameter of the "set" block indicates the name of the variable, and the second parameter assigns a value. Next, pair up students and ask them to brainstorm other ways they can visualize how variables work. Discuss their answers as a class.
Activities (40+ minutes)Facilitate as students complete the Virtual Pilot 2 modules on their own:
1. Concepts (Concept)
- Students are introduced to variables. Variables store information and keep track of changing values. They also allow programs to "remember" things that have happened previously, like how many times the drone has flipped.
- Point out to students that they can name and store a value in the variable code blocks.
- Students will learn that they can combine variables and conditionals in their project.
- Make sure students click the provided code blocks.
- In this DIY (do-it-yourself) project, students will create a variable to keep track of whether the drone's tilt controls are on or off. The drone will only move based on the device's tilt when the variable is true.
- Explain to students that a "global variable" is a variable that can be accessed and changed by all Actors as well as the Stage. In Tynker, global variables are defined on the Stage.
- Coding activities include creating a global variable, using conditionals to make the drone move if the tilt amount is high enough and the tilt controls are on, naming and setting variables, and customizing the project.
- When students finish coding their project, ask them to test it out! They should be able to turn tilt controls on or off using the green and red buttons. Tapping the green button should make the drone respond to tilt controls. Tapping the red button should turn off tilt controls.
- In this project, students can design virtual stunts and then test them out on a real drone. What fun stunts will they create?
- Do students need help thinking of stunts? Ask them to refer to previous puzzle modules for inspiration. Can they recreate the virtual drone's behavior from their favorite puzzle module?
Extended ActivitiesReview today’s coding adventure by leading a discussion. Ask students:
- What are variables? (Answer: A value or piece of information that is stored and can be changed)
- How did you apply variables in today's lesson?
- 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
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
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..
Fly by Feel
Virtual Pilot 2
Grabber and Cannon