STEMLabs V5
Clawbot With Controller Teacher

Teacher Portal

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 while True infinite loop structure 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 instruction placed inside a loop will repeat according to the rules of the loop. For example, any behavior inside a while True loop is repeated for the duration of the project.
• 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 instruction 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 from the Control category, are what you would need for the 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 instruction to your project 10 separate times. Because you can use a Loop, you are saving time adding instructions to your project, and because you can accomplish the same goal by adding a single Loop structure, you can also keep your project free of unnecessary additional instructions. 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.

Extend Your Learning - Loops in Life

We often use Loops without realizing it when we give instructions. Click here (Google / .docx / .pdf) for a classroom exercise that will demonstrate how loops can simplify a set of instructions.