Skip to main content
Teacher Portal

Play

Part 1 - Step by Step

  1. InstructInstruct students that they are going to build on what they learned in Lab 2 to have the Code Base collect and sort a different Martian rock sample to a different area. The new sample will be represented by the Blue Disk. They will add to their Lab 2 projects to code their robot to sort the Disk, based on its color.
    • Show students the Field setup with the sorting areas marked with the ‘R,G, B.’  They will need to drop the Blue Disk in the Blue sorting area.

    Top down view of a GO field with a blue disk in the top left and three horizontally-adjacent squares in the bottom right labeled with the letters R, G, and B. The letters indicate the spaces that the corresponding colored disks will be placed in.
    Field Setup
    • Students will build this project with you then test it on the Mars surface (the Field). The animation below shows how the Code Base will move when this project is started. The robot first drives forwards until it reaches the Blue Disk and then powers its electromagnet to pick it up. Next, the robot turns around and drives back to its starting position, before turning 90 degrees to the left and driving forwards to reach the sorting area marked with the letter B for blue. After reaching the B, the robot drops the Disk and then drives in reverse back to its starting position.
    Video file
  2. ModelModel for students how to build the project in VEXcode GO and test their projects on the Field.

    Continuation of the VEXcode GO blocks project, now with the two Drive For blocks in the second If Then block's distance changed from 100mm to 350mm. The whole project now reads When Started, to collect the disk drive forward for 400mm and then energize the magnet to boost. Next, turn right for 180 degrees and drive forward for 400mm. To sort the disk, turn left for 90 degrees and if eye detects red then drive forward for 100mm and energize the magnet to drop. Next, and still inside the If Then block, drive reverse for 100mm and turn left for 90 degrees. Close the first If Then block and start a new one, if eye detects blue then drive forward for 350mm and energize the magnet to drop. Finally, and still inside the If Then block, drive reverse for 350mm and turn left for 90 degrees.

    Completed VEXcode GO blocks project titled 'Sort Blue'. This project is the same as it was in the last step. The whole project reads When Started, to collect the disk drive forward for 400mm and then energize the magnet to boost. Next, turn right for 180 degrees and drive forward for 400mm. To sort the disk, turn left for 90 degrees and if eye detects red then drive forward for 100mm and energize the magnet to drop. Next, and still inside the If Then block, drive reverse for 100mm and turn left for 90 degrees. Close the first If Then block and start a new one, if eye detects blue then drive forward for 350mm and energize the magnet to drop. Finally, and still inside the If Then block, drive reverse for 350mm and turn left for 90 degrees.
    Sort Blue Project

    Model for students how to test their project on the Field.

    • First, show them how to place their robot at the starting point (the Mars Base) and the Blue Disk on the Field as shown in the image below.  Use the gridlines on the Field to help with alignment. The Disk and the Electromagnet can both be lined up on intersecting grid lines of the Field, to make it easier for students to be set up for success when they test their projects.

    Top down view of a GO field with a blue disk in the top left and three horizontally-adjacent squares in the bottom right labeled with the letters R, G, and B. The letters indicate the spaces that the corresponding colored disks will be placed in. The robot is placed in its starting position near the bottom left corner, directly below and facing the blue disk.
     Setup to Test
    • Once the Code Base is in place, select 'Start' in VEXcode GO to test the project.  Watch as the Code Base drives to collect the Blue Disk, return to the Mars Base, then deliver it to the blue sorting area.

    VEXcode GO Toolbar with the Start button called out in a red box, in between the Brain and Step icons.
     Select 'Start' to test the project
    • Students will need to select the 'Stop' button in the VEXcode GO Toolbar to stop the project.
    • For students who finish early and need additional challenges, have them place the Red Disk on the field in the same location, then start their project. Does the Code Base deliver the Red Disk to the red sorting area? What would happen if they tried their project with a Green Disk? Try it!
  3. FacilitateFacilitate a conversation with students as they test their projects.
    • How does the Code Base need to move to collect the Disk? Can you show me with your hands? 
    • Does the Code Base need to turn? How far? In which direction?
    • How will the Code Base move to deliver the Disk to the sorting area? Which direction will it turn? How far does it need to drive to reach the sorting area?
    • How does the Code Base know if the Disk is Blue or a different color? 
    • What blocks are used to have the Code Base detect the color of the Disk?
    • What would happen if the Code Base detected red? Would the Code Base deliver the Red Disk to the same location as the Blue Disk? Why not?

    Focus on the concept, not the precision.

    • The goal of this Lab is to focus on the concept of using the Electromagnet in a project. If students slightly misaligned their robot, or the Disk is not exactly in the right place when they drive to it, let them know that it's ok to move the Disk slightly to make sure it gets picked up by the Electromagnet.
    • Also, let students know that it’s okay to nudge the Disk into the sorting area if it is mostly, but not completely in the sorting area square. 
  4. RemindRemind students to check the parameters in the [Drive for] blocks to make sure the project has the correct distances needed to collect then sort the Disk.

    In order to encourage a growth mindset and help students embrace the trial and error that is a part of coding and encourage them to learn from the mistakes along the way, ask questions such as:

    • What mistake have you make that has taught you something?
    • What did you learn from this mistake? How can it help you when coding the Code Base next time?
    • What part of the Lab is tricky, or is making you think hard?
  5. AskAsk students how they might use an [If then] condition to code the Perseverance Rover to sort Martian rock samples into two categories: rocks that show signs of ancient life, and rocks that do not.

Mid-Play Break & Group Discussion

As soon as every group has tested their project to have the Code Base collect and deliver the Blue Disk to the sorting area, come together for a brief conversation.

Discuss what happens in the projects when the Code Base makes a decision based on the conditions created with the [If then] blocks. Show the animation below of the project running with each block highlighted as it runs, or a Sort Blue project running in VEXcode GO. Draw students' attention to the highlight feature, and how the highlight skips the first [If then] block because the condition (Eye Sensor detects red) is False. The highlight shows how the project moves to the next [If then] block. Since the Eye Sensor detects blue, the condition is True, and the blocks inside the [If then] 'C' block will run. Make sure students understand that the blocks inside the [If then] block will only run if the condition is True.

Video file
  • Why is one of the [If then] blocks “skipped?” What is happening instead?
  • What happens in our project when the condition of the [If then] block is False? Do the blocks inside the [If then] 'C' block run? 
  • What happens if the condition of the [If then] block is True?
  • What if we had the Code Base collect a Green Disk? Would either of the [If then] blocks run? Why?
  • What if we wanted to have the Code Base sort a Green Disk? What would we need to add to our projects?

Note: If you want to slow down the project flow even further, Step through the project using the Stepping Feature, and discuss why the first [If then] block is “skipped.” For more information on how to use the Project Stepping feature, view the Stepping Through Blocks tutorial in VEXcode GO.

Part 2 - Step by Step

  1. InstructInstruct students that they are going to apply what they learned in Play Part 1 and add to their projects to have the Code Base collect and sort the Green Disk. They will need to change parameters in their projects to have the Code Base deliver the Disk to the green sorting area.

    Once they have successfully sorted the Green Disk, they will experiment with all three Disks. Can they have the Code Base collect and deliver all three Disks to the proper sorting areas?

    • Show students the new Field setup and provide them with the drive distances to the green sorting area so that they can focus on the code for this project. The Code Base will need drive 250 millimeters (mm) (~10 inches (in)) from the Mars Base to and from the Green sorting area.

    Top down view of a GO field with a green disk in the top left and three horizontally-adjacent squares in the bottom right labeled with the letters R, G, and B. The letters indicate the spaces that the corresponding colored disks will be placed in.
    Play Part 2 Field Setup
    • The following animation shows one possible way that the Code Base can move to collect and sort the Green Disk. The robot first drives forwards until it reaches the Green Disk and then powers its electromagnet to pick it up. Next, the robot turns around and drives back to its starting position, before turning 90 degrees to the left and driving forwards to reach the sorting area marked with the letter G for green. After reaching the G, the robot drops the Disk and then drives in reverse back to its starting position.
    Video file
  2. ModelModel for students how to get started with their projects in VEXcode GO.

    If necessary, model for students how to test their project on the Field.

    • Show them how to set up to test by placing the Code Base at the Mars Base.

    Top down view of a GO field with a green disk in the top left and three horizontally-adjacent squares in the bottom right labeled with the letters R, G, and B. The letters indicate the spaces that the corresponding colored disks will be placed in. The robot is placed in its starting position near the bottom left corner, directly below and facing the green disk.
    Set up to test
    • Once the Code Base is in place, select 'Start' in VEXcode GO to test the project. 
    • Students will need to select the 'Stop' button in the VEXcode GO Toolbar to stop the project.

    Once students have successfully delivered the Green Disk to the correct sorting area, have them test their project with all three colored Disks. Can they code the robot to deliver all three Disks to the correct sorting areas? 

    • They should place the Disk, then start their project. Does the Code Base deliver it to the correct sorting area?
    • Once the Code Base sorts a Disk successfully, they can try again with another Disk. Can the sort all three? Try starting with a Blue Disk, then a Green Disk and finally a Red Disk.
       
  3. FacilitateFacilitate a conversation with students as they build and test their projects with questions such as:
    • What do you have to add to your project to have the Code Base detect the Green Disk? 
    • What parameters do you have to change to have the Code Base drop the Disk at the new sorting area?
    • How does the Code Base detect the color of a Disk?  How does the Code Base know where to deliver the Disk?

    Prepare students for the trial and error that is an intrinsic part of this challenge. You may want to use the Problem-solving Cycle graphic from the Background page as a visual aide to establish a structure for the problem-solving process with your students.

    Diagram of the Student Problem Solving Cycle. Arrows show that the cycle repeats. The cycle starts with 'Describe the problem', then 'Identify when and where the problem began', then 'Make and test edits', and finally 'Reflect' before repeating.
     Student Problem-solving Cycle

    There are many possible solutions for this challenge. The following is one example.

    Example VEXcode GO blocks project that is a continuation of the Sort Blue project and now can deliver green disks too. This project is the same as it was in the last step. The whole project reads When Started, to collect the disk drive forward for 400mm and then energize the magnet to boost. Next, turn right for 180 degrees and drive forward for 400mm. To sort the disk, turn left for 90 degrees and if eye detects red then drive forward for 100mm and energize the magnet to drop. Next, and still inside the If Then block, drive reverse for 100mm and turn left for 90 degrees. Close the first If Then block and start a new one, if eye detects blue then drive forward for 350mm and energize the magnet to drop. Next, and still inside the If Then block, drive reverse for 350mm and turn left for 90 degrees. Close the second If Then block and start a new one, if eye detects green then drive forward for 250mm and energize the magnet to drop. Finally, and still inside the If Then block, drive reverse for 250mm and turn left for 90 degrees.
    Sort All Project

    Focus on the concept, not the precision.

    • The goal of this Lab is to focus on the concept of using the Electromagnet in a project. If students slightly misaligned their Code Base, or the disk is not exactly in the right place when they drive toward it, remind them that it is ok to move the disk slightly to make sure it gets picked up by the Electromagnet.
    • Also, let students know that it’s okay to nudge the Disk into the sorting area if it is mostly, but not completely in the sorting area square.

    If students need additional support to connect the behaviors of the Code Base with the block commands in their project, use the Project Stepping feature to help students go through their project one block at a time to see how each block is being executed in their project. For more information on how to use the Project Stepping feature, view the Stepping Through Blocks tutorial in VEXcode GO.

    Icon for the Stepping Through Blocks tutorial in VEXcode GO.
    Stepping Through Blocks Tutorial in VEXcode GO
  4. RemindRemind students to check the order (or sequence) of the blocks, and the parameters of the blocks in their projects before they test on the Field.
    • How does the Code Base need to move to collect then sort the Disk? Can you show me with your hands? 
    • Does the Code Base need to turn? How far? In which direction?
    • What blocks are inside each of the [If then] blocks? Will these drive the Code Base to the correct sorting area?
    • Was the sorting area further away? How can you change the parameter in the [Drive for] block to have the Code Base drive to the correct sorting area (250 mm to green sorting area)?
    • Is the <Detects color> block set to ‘green’ (the color of the Disk)?

    Talk students through problem-solving each issue as you circle the classroom. This will be an iterative process, so remind students that scientists who code the Mars rovers also have to try multiple times to get the rover to move how they intended. 

    • What mistake have you made that has taught you something? What did you learn from this mistake? How can it help you when coding the Code Base next time?
    • What did you change in your project to make it work better?
    • What change did you make that made your project less successful? How did you fix it?
    • What is something you learned in other Labs that you used to help you in this Lab?
  5. AskAsk students to think about how their project has changed from Lab 2 to Lab 3.
    • How has your project changed from Lab 2 until now?  What have you added? How has this changed the behaviors of the Code Base?
    • What could the Code Base do in Lab 2? What can it do now? What have you added to your project to make this happen?