Teacher Toolbox - The Purpose of this Section
The goal of the Play section is for students to learn to program the VEX V5 Clawbot to move using the Controller. Learning how to utilize the Controller is important if students want to go on to participate in competitions. Controllers are also a fun way for students to learn important programming concepts like Loops and Events. To begin the Play section, students are introduced to programming with Loops. Next, students will do an exploration where they will learn how to connect the Controller and program the Clawbot to respond to the Controller, utilizing the [forever] block by downloading and running an example project. Use the Motivate Discussion questions to review with students what Loops are and how they are used for repeated Clawbot behaviors.
“Loops” give the Clawbot the ability to repeat behaviors. Any block or instruction placed inside a loop will repeat according to the rules of the loop. For example, any behavior inside a [forever] loop is repeated for the duration of the project.
While a [forever] loop repeats the behaviors inside for the duration of the project, other loop blocks like the [repeat] block can be set to other parameters. For more information on blocks, visit the Help information or view the tutorial on Loops.
As students begin the task of opening the example project for the Clawbot to perform Loops, they should also begin thinking about the Clawbot’s actions in terms of repetition. First, students should decide:
Which behaviors should be repeated?
How many times or for how long should the behaviors be repeated?
The plan will simply be the sequence of behaviors that the Clawbot needs to repeat, and the project will just be those behaviors translated into VEXcode V5.
You can pair the Controller to the Robot Brain before class to save time. Or you can have students do it during class by following the steps here. You can have this article printed out for students to use.
Simplify Projects with Loops
We, as humans, repeat many behaviors in our daily lives. From eating and sleeping to brushing our teeth and walking our dogs, much of what we do each day is repetitive. In math class, we know that multiplying a number by zero, will always equal zero, or that multiplying a number by one will always equal itself, no matter how many times we do it. While we have a tendency to repeat our behaviors, our instructions can sometimes be simplified. For example, if you’re using a recipe to bake a cake, it wouldn’t tell you to “add 1 cup of sugar, add 1 cup of sugar, add 1 cup of sugar, add 1 cup of sugar.” Instead, it would simply tell you to add four cups of sugar and you would scoop out 1 cup of sugar four times.
With robots, Loops help us simplify our projects. Instead of adding the same block four times, for example, we can use a Loop to tell the robot to perform the same behavior four times, saving time and space as we build our projects. Imagine a task that a robot might perform that would require repetition to complete the task. Those behaviors, along with a Loop block from the Control block category, are what you would need to project to achieve the task.
Motivate Discussion - Repeating Behaviors
Q: How can the use of loops save time and prevent errors both for a human and a computer/robot?
A: Let’s say you want the robot to repeat the same behavior 10 times. Without Loops, you’d have to add the same block to your project 10 separate times. Because you can use a Loop, you are saving time adding blocks to your project, and because you can accomplish the same goal by adding a single Loop block, you can also keep your project free of unnecessary additional blocks. Humans also have the ability to make mistakes, especially if they are repeating a behavior over and over. Each time the behavior is repeated, it may not have been done exactly as it was before.
Q: What are some advantages robots have in the repetition of behaviors over humans?
A: Humans can only perform most behaviors for a certain amount of time, while robots can perform behaviors for as long as they are needed. Robots can do things consistently for a long time; they don’t need breaks like humans.
Q: Where are Loops used in our everyday lives?
A: Examples will vary; however, all should clearly demonstrate a repetitive function. One example might be the school schedule. Every day, students repeat the behavior of going from one class to the next when the bell rings, depending on that day’s schedule.