Skip to main content
Teacher Portal

Event-Based Programming: Communication Among Blocks

Teacher Toolbox icon Teacher Toolbox - The Purpose of this Section

The goal of the Rethink section is for students to use buttons on the Controller using event-based programming.

VEXcode IQ When controller button event block set to L up and pressed.

This section includes:

  • Event-Based Programming Overview
  • Example Project Download Instructions & Overview
  • Remix Activities:
    • Activity A: Grab objects and return them to a location!
    • Activity B: Stack objects!
    • Activity C: Relay race
  • Remix Questions

Teacher Tips icon Teacher Tips

  • The Controller can be paired with the Robot Brain before class to save time. Decide whether you want to complete this step or if you would like students to do so. Follow the steps here. You can have this article printed out for students to use, if you want them to pair the Controller to the Brain.
  • Event-based programming gives the Clawbot the ability to trigger events or react to triggers. This type of programming enables one block to communicate with other blocks.

In other words, the Clawbot responds to the movements of the Controller’s Joysticks. The movement of the Joystick is the trigger, and the Clawbot responds accordingly.

VEXcode project with a When Controller button event block set to L Up and pressed and a spin arm motor up block attached.

In the above example, pressing the L button is the trigger that spins the ArmMotor up. The {When Controller button} block communicates that message to the [Spin] block. Click here (Google / .docx / .pdf) to learn more about these blocks and how they’re used in the Clawbot Control example project.

Teacher Toolbox icon Teacher Toolbox - Students' Rethink Roles

At the beginning of the Rethink section, put the students into their groups and have the students choose their roles. For a refresher on the roles and tips for facilitating groups, click below.

Google Doc / .docx / .pdf

A dog sitting by a door with a leash, signaling that it needs to go outside. This image illustrates the concept of triggers, similar to how robot behaviors are triggered in event-based programming.

Event-based programming

If your dog brings you his leash or sits by the door, he’s letting you know that he needs to go outside. In school, when your teacher asks a question and sees you raise your hand, she knows that you believe you know the answer and would like to answer the question. These behaviors are also known as “triggers.”

Your dog knows that bringing you his leash or sitting by the door is the trigger that lets you know he needs to go outside. So, when you see him sitting by the door with his leash, you react to the trigger by taking him outside. Raising your hand is the trigger that lets the teacher know you would like to answer her question. The teacher then reacts to the trigger by calling upon you.

Event-based programming in robotics is when certain robot behaviors trigger the robot to do certain things or react to certain triggers.

To learn more about event-based programming, watch our tutorial on events by clicking Tutorials in the toolbar and selecting the Events tutorial.

VEXcode IQ Toolbar with the Tutorials icon called out with a red arrow, to the right of the File menu.

 

Teacher Toolbox icon Teacher Toolbox - Reviewing the Blocks

  • As a whole class activity, review the programming blocks with the students. Tell the students that multiple events within the Clawbot Control project can be triggered at the same time, enabling them to control the Clawbot’s driving movement as well as the movement of the Clawbot’s Arm and Claw.
  • If students need a quick review of VEXcode IQ, they can reference the Tutorials at any time during this investigation. The Tutorials are located in the toolbar. Students can review saving, downloading and running a project, along with other items, with the tutorials.

VEXcode IQ Toolbar with the Tutorials icon called out with a red arrow, to the right of the File menu.

 

Controller: Clawbot Control

Now, you’re ready to download the example project and use the Controller to operate the Clawbot, its Arm, and its Claw, all at the same time!

The Builder in each group should get the hardware required. The Recorder should get the group’s engineering notebook. The Programmer should open VEXcode IQ.

Materials Required:
Quantity Materials Needed
1

Clawbot

1

Charged Robot Battery

1

VEX IQ Radio

1

Controller

1

Tether Cable

1

VEXcode IQ

1

USB Cable (if using a computer)

1

Engineering Notebook

Teacher Tips icon Teacher Tips

  • Make sure each student group has all of the necessary materials.

  • Model each of the troubleshooting steps for the students. Remind the students that each group has someone in the role of the builder. That person should be checking these items throughout the exploration.

Before you begin the activity...

Do you have each of these items ready? The Builder should check each of the following: