Sometimes when sending a message from one robot to another, you want to be able to control what message is sent, and when. You can do this by coding your robot to use an input, such as a screen press or controller button, to send a message! In this lesson, you will learn how to create projects that use the One Stick Controller to send different messages depending on which controller button is pressed.
Watch the video below to learn how to:
- Code different messages for each controller button pressed.
- Use a loop so that messages can be received continuously through controller button presses.
Now that you have watched the video, capture your thoughts in your journal. Answer these questions to guide your thinking and help you get ready for a whole-class discussion:
- Why are the controller button presses part of the sending robot's project?
- What did the receiving robot do when it received a message?
- How do you know the receiving robot is reacting to a message from the sending robot?
Now that you have watched the video, capture your thoughts in your journal. Answer these questions to guide your thinking and help you get ready for a whole-class discussion:
- Why are the controller button presses part of the sending robot's project?
- What did the receiving robot do when it received a message?
- How do you know the receiving robot is reacting to a message from the sending robot?
After students watch the video and before practicing, come together for a whole-class discussion. Use student answers to the questions provided as the basis for discussion. Note student responses on the board, so they can revisit them as needed. Encourage students to refer to their notes in their journals to support their assertions.
Guided Practice
Next, it’s your turn to practice! You will collaborate to create projects for Robot S to direct Robot R to do five dance moves, each triggered by one of the controller buttons.
- Use this task card (Google / .docx / .pdf) to guide your practice.
- Don't forget to pair your controller to the sending robot! See the article linked below if you need help.
Resources for Practice:
The articles linked here are available if you need additional support while completing the activity.
- Accessing Help in VEXcode AIM
- Connecting the One Stick Controller to VEX AIM
- VEXcode API Reference - Message category
- VEXcode API Reference - when controller button block
Next, it’s your turn to practice! You will collaborate to create projects for Robot S to direct Robot R to do five dance moves, each triggered by one of the controller buttons.
- Use this task card (Google / .docx / .pdf) to guide your practice.
- Don't forget to pair your controller to the sending robot! See the article linked below if you need help.
Resources for Practice:
The articles linked here are available if you need additional support while completing the activity.
- Accessing Help in VEXcode AIM
- Connecting the One Stick Controller to VEX AIM
- VEXcode API Reference - Message category
- VEXcode API Reference - when controller button block
Distribute the Step 1 task card (Google / .docx / .pdf). As students collaborate to plan and code their projects, circulate through the room and ask questions such as:
- On Coding:
- What message does Robot S send for each controller button press?
- What do you have to consider when deciding what message to send with each button?
- What moves are you having Robot R perform for each button press?
- Has Robot R ever performed an unexpected move? If so, how are you finding and fixing that bug?
- On Collaboration:
- How are you agreeing on what messages Robot S will send?
- How are you agreeing on what moves Robot R should perform when a message is received?
Wrap Up
After completing the activity, it is time to share what you learned about creating robot-to-robot messaging projects that use the controller as an input. Answer the following questions in your journal to help you reflect on your learning and prepare for a whole-class discussion:
- What did you have to think about when deciding which message to send with each button?
- How did you match the message sent by Robot S to the right behavior in Robot R’s code?
- How does using the controller help you control which dance move Robot R performs, and when?
- Can you think of any other instances where using an input to control the timing of robot-to-robot messages would be helpful?
After completing the activity, it is time to share what you learned about creating robot-to-robot messaging projects that use the controller as an input. Answer the following questions in your journal to help you reflect on your learning and prepare for a whole-class discussion:
- What did you have to think about when deciding which message to send with each button?
- How did you match the message sent by Robot S to the right behavior in Robot R’s code?
- How does using the controller help you control which dance move Robot R performs, and when?
- Can you think of any other instances where using an input to control the timing of robot-to-robot messages would be helpful?
Guide students to share their learning in a whole-class discussion. Help students reflect on their learning through practice to converge on shared understandings or learning targets.
Use the questions students answered in their journals as the starting point for the discussion. Ask follow-up questions to guide student understanding:
On sending messages using the controller:
- What is the advantage of using an input like the controller to send messages?
- How does the loop help ensure Robot R receives all the messages you want to send?
- What are some important considerations for planning a robot-to-robot messaging project using the controller?
On collaboration:
- What guidelines would you share with others trying to collaborate to create robot-to-robot messaging projects using the controller?
- How did you ensure everyone had an opportunity to plan, code and run the projects?
Select Next > to move on to the Unit Challenge.