Skip to main content

Mars Rover-Landing Challenge
Lab 1 - Detect Obstacles

Teacher Portal


Part 1 - Step by Step

  1. InstructInstruct students that they are going to build a project in VEXcode GO to drive the Code Base until it detects an object on the Mars landing area (the Field). This animation shows how the Code Base will move when this project is started.

    Be sure to use light or white-colored objects to represent the "obstacle" on the landing area to ensure the Eye Sensor will detect this object. Students can remove the obstacle once the Code Base drives up to it and stops.

    Video file
  2. ModelModel for students how to build the project in VEXcode GO and test their projects on the Field.

    image of the Drive block under the When started block
    Add [Drive] block

    • Then have students add a [Wait until] block. Next, drag a <Found object> block inside the hexagonal space within the [Wait until] block.

    image of a wait until block with the object found block inside the hexagonal space added to the project
    Add [Wait until] with <Found object>

    • Have students add a [Stop driving] block to have the Code Base stop driving when an object is detected.

    Image of the project with the Stop Driving block added
    Add [Stop driving]

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

    • First, show them how to place the obstacle and the Code Base on the square with the"X."

    image of the GO Field with an X on a bottom square and the obstacle placed 3 squares directly in front of the X
    Place the Obstacle on the Field and the Code Base on the "X"

    • Ensure that the Eye Sensor, located on the front of the robot, is facing the obstacle.

    image of the Code Base with the Eye Sensor facing the obstacle on the field
    Eye Sensor faces obstacle

    • Once the Code Base is placed on the Field, have students select ‘Start’ in VEXcode GO to test their projects.

    image of the start button called out on the VEXcode GO toolbar
    Select Start to test project

    • After the project is finished running, students will need to select the “Stop” button in the Toolbar.

    image of stop button in the VEXcode GO toolbar
    Select Stop

    • For groups who finish early and need additional challenges, have them move the obstacle to a new location and test their project again.

  3. FacilitateFacilitate a conversation with students as they test their projects.
    • How does the Code Base robot move in this project? Can you show me with your hands?
    • How did the Code Base rover know when to stop?
    • How do you know when there is something in front of you?  
    • If you were the Code Base rover, which of your senses would help you drive until an object?
  4. RemindRemind students that even though this is a small project, they may make mistakes and it may take more than one try to have their project work successfully. In order to encourage students to embrace the mistakes along the way, ask questions such as:
    • What mistake did you make that taught you something?
    • What part of the Lab made you think hard?
    • Was it difficult to line up the Code Base rover so that the Eye Sensor faced the object? What strategy did you use to line it up?
  5. AskAsk students to name or describe a device or object that they think uses an eye sensor. Ask them if they have heard of a robot vacuum cleaner? Can they describe how the [Drive], [Wait until], and <Found object> commands might work with this device?

Mid-Play Break & Group Discussion

As soon as every group has finished testing their projects, come together for a brief conversation.

  • Project your screen so all students can see the code, or bring students to a central area where they can all see the code on your tablet or computer.
  • Start the Drive Until 1 project and ask students to watch the code as the project runs and describe what they see. Direct students to describe what happens with the highlight feature, and identify that it stays on the [Wait until] block until the Eye Sensor detects an object.
    • How does the green highlight move when we start our project?  
    • Why do you think the green highlight pauses on the [Wait until] block?
    • What do you think the highlight tells us?

Part 2 - Step by Step

  1. InstructInstruct students that they will be adding onto their project so the Code Base rover signals when the Eye Sensor has detected an obstacle in the Mars landing area. Students will add an LED Bumper Sensor to their robot, then add [Set bumper color] and [Wait] blocks to their project to create a signal effect.

    As they test their projects, they will remove the obstacle when the robot glows. The animation below shows how the Code Base rover will move when the project is started. Once the LED Bumper on the Code Base glows, students will need to remove the obstacle from the Field. This is also shown in the animation.

    Video file
  2. ModelModel for students how to add the LED Bumper sensor to their Code Base rover.
    • There are many ways that students can add the LED Bumper to the Code Base. Below is one quick and easy way to add it to the top of the Code Base using only 2 Red Pins and the sensor. The LED Bumper Sensor will need to be connected to Port 2 on the GO Brain. 

    Image of the LED Bumper being attached to the top of the Code Base Brain with 2 red pins. This sensor will need to be connected to Port 2 on the GO Brain.
    Add LED Bumper Sensor and Connect to Port 2

    Model how to build onto their existing VEXcode GO project and test it on the Field.

    • If students need to open their Drive Until 1 project, model the device-specific steps, as shown in the Knowledge Base articles in the Open and Save section.
    • Have students add blocks to their VEXcode GO projects to recreate the code in the image below. The new blocks will have the LED Bumper glow red for 3 seconds to signal that it detects an object. The red box indicates the new blocks that need to be added to the project.
      image of the following blocks added to the VEXcode GO project: [Set bumper to red] [Wait 3 seconds] [Set bumper to off]
      Add blocks to have the LED Bumper glow
      • The [Set bumper color] block set to red will make the LED Bumper glow red.

      • The [Wait] block waits for a specific amount of time before moving on to the next block.

      • The [Set bumper color] block set to off will stop the glow effect.

    • Once students have built their project, have them name their project as Drive Until 2 and save it to their device. See the Open and Save section of the VEXcode GO Knowledge Base for device-specific steps to save a VEXcode GO project.

    • Have students place their Code Base on the field to test their project.

    image of field set up with obstacle at the top
    Place the Obstacle on the Field and the Code Base on the "X"

    • Once the Code Base is placed on the Field, have students select ‘Start’ in VEXcode GO to test their projects.

    image of Start button on the VEXcode GO Toolbar
    Select Start to test the project

    • After the Code Base drives until it detects the obstacle, the LED Bumper should glow red for 3 seconds to signal that it detects an object. Students should remove the object when the LED Bumper glows green.
    • Tell students that they will need to select the “Stop” button in the Toolbar after they remove the object.

    image of the Stop button in the VEXcode GO Toolbar
    Select Stop

    • If students finish building and testing their projects quickly, have them add additional Drivetrain blocks to their project to have the Code Base rover return to the start position. Encourage them to experiment with the different paths that the Code Base can take to get back to the starting point. 
  3. FacilitateFacilitate students testing their projects and taking turns on the Field. As students are testing, ask them questions about the Eye Sensor, and how the Code Base will move based on the blocks in their project.
    • How is your Code Base rover going to signal that it has detected an object? What blocks are you using to accomplish this?
    • How far away from the obstacle is the Code Base rover when it stops driving? Can you show me with your hands?
    • What blocks in our project tell the Code Base rover to stop driving?

    Review the Using the VEX GO Sensors and the Coding with the VEX GO LED Bumper articles for information on the LED Bumper to help students who need additional support to understand how the sensors work in their project.

  4. RemindRemind students that they should check their project and compare it to the image of the project, before testing. If one student built the project in VEXcode GO, their partner can check the code, before placing the Code Base on the Field and starting the project.
  5. AskAsk students, how do scientists explore faraway places?

    Scientists and engineers design different kinds of robots to explore areas that are too far away or too dangerous for humans to investigate. Scientists design rovers to explore Mars, unmanned submarines to investigate the ocean, and even fly drones into active volcanoes to gather data!  

    • How could scientists code a submarine to use eye sensors to explore the ocean?
    • How could scientists use eye sensors on a drone to help explore a volcano? What command would they use to have the drone fly until it is near the volcano walls?
    • What other tasks could scientists code a Mars rover to do with an eye sensor?