Lesson: Remote Control
Time: 40+ mins
IntroductionIn this lesson, students will learn how to control the drone using a virtual remote controller within Tynker. Additionally, students will learn about functions. Functions are a group of code commands that can be used and reused by different Actors. They're super useful if you want to repeat your code! Students will explore this concept further in today's coding adventure when they create button Actors that tell the drone what to do.
Important: This lesson has 2 DIY projects that require at least one Parrot drone.
New Code Blocks
: Run code attached to this block when the Actor is clicked. Note: this block is titled “when actor touched” for mobile version.
- Function: A sequence of commands that can be used and reused by different Actors. Functions are usually used when the same instructions must be repeated.
- Function Definition: A function code block that describes what the function will do. Any code blocks attached to this rounded block will be activated by the function call block.
- Function Call: You can use this rectangular block multiple times in your code to call the code under the function definition block.
- Use code blocks to solve a puzzle module
- Create and use functions
- Apply coding concepts to create 2 projects
- Create button Actors that can be used to control the drone
- 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)Inform students that they're going to use drone code blocks to make the drone perform unique tricks in the air! Pair up students then ask them to think of a trick they would like the drone to perform. What code blocks do they need? What does the sequence look like? Encourage students to share their ideas with the class. Students can refer to their sequence in today's DIY projects.
Activities (40+ minutes)Facilitate as students complete the Remote Control modules on their own:
1. Concepts (Concept)
- Students will watch a short animation of a friendly scientist introducing functions. They're also introduced to the idea that there are other types of Actors in Tynker (beyond the Drone Actor). If they're new to Tynker, clarify that some Actors don't correspond to real-world devices (e.g., the Parrot drone) and just appear on the Tynker Stage.
- Students will learn that they're going to use functions to create a remote control that makes the drone respond when different virtual buttons on the tablet are pressed.
- Point out the two components to a function: the "function definition" and the "function call". The "function definition" block has a rounded top and notch in the bottom, whereas the "function call" block looks like a regular Tynker block (notch on top and bottom).
- Explain that the code blocks attached to the "function definition" block defines what happens when the function is called. To call the function (and execute all the code under the "function definition" block, students need to use the "function call" block.
- Students are introduced to the "when Actor clicked" code block, which will run the code attached to it when the Actor is clicked. Note: Inform mobile users that this block is titled “when actor touched”.
- To solve this puzzle, students need to code several Actors to create a basic controller that will navigate the drone to the landing pad.
- Explain to students that several functions have been created for them. They need to program each function to perform the correct action. Give a hint: Tell them to change the second parameter in the "function call" block. Remind students to set the speed of the drone.
- In this DIY (do-it-yourself) project, students will use functions to program 4 different button Actors. Each button Actor will trigger the drone to perform a different trick!
- Coding activities include programming the drone to take off, creating functions, creating a sequence of commands to make the drone perform a trick in the air, programming the button Actors to call different functions, making the drone land, and customizing the project.
- Make sure students know how to create functions:
- For web-
1. Click the blocks tab.
2. Click the Functions icon.
3. Click the Add Function button.
4. Name the function.
- For mobile-
1. Tap the "Functions" tab.
2. Press the "+ New Function" button.
3. Name the function.
- Tell students to name their functions "trick1", "trick2", "trick3", and "trick4".
- Point out to students that they should include all of the "function definition" blocks (which have a rounded top and notch in the bottom) in the drone Actor's script.
- Explain that each button should call the relevant function in the drone Actor. For example, the button1 Actor's code should look something like this:
Whereas the button2 Actor's code might look like this:
- Are students struggling to think of tricks? Ask them to refer to today's warm-up activity, or they can program the drone to draw a shape—similar to what they did in the previous lesson.
- Ask students to experiment with the "flip" code block, which makes the drone perform a flip while flying. Here's what is looks like:
- In this project, students will make a drone controller that has more buttons than the previous project! Students will need to know how to apply functions to create buttons that control their drone. If they need a review, refer them to the previous DIY project and ask them to read the tutorial instructions carefully.
- Coding activities include programming the drone to take off, creating and then calling functions, creating a sequence of commands, programming button Actors to call different functions, and making the drone land.
- Explain to students that in the previous project, they were creating different tricks for each button Actor. Here, they need to create a sequence that will make the drone move or turn in different directions when a specific button is pressed.
- Make sure students create sequences of code that align to the button Actors. For example, they should make the drone turn left when the "turn left" button is pressed.
- Students will be asked multiple-choice quiz questions to review concepts from this lesson.
Extended ActivitiesReview today’s coding adventure by leading a discussion. Ask students:
- How did you apply functions in today's lesson?
- Did you add additional buttons to your drone controller? If so, what did the buttons make the drone do?
- What other ways can you improve your drone controller?
- 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