Vernier Software and Technology
Vernier Software & Technology

Wild, Wild Mars

Figure from experiment 4 from Coding with Codey Rocky: Mission to Mars


Living on Mars will be difficult for many reasons—the cold, the lack of oxygen, dust storms, the limited resources, among others. The humans that settle on Mars will have to contend with those known challenges, as well as with plenty of unforeseen challenges. Mars is a wild place. Settlers will have to be creative, resourceful, and hard working.

Take, for instance, retrieving ice from one of the poles. Robots sent to gather ice will have to climb over mountains and through valleys, avoid steep drops and unstable sand. In the previous activity, we plotted a simple route for Codey Rocky to collect ice. But in the real world, an ice-gathering robot will have to be smart enough to do some navigating on its own. Codey Rocky will have to be able to recognize obstacles in its way and figure out how to get around them by itself.

Codey Rocky has some sensors to help it "see" the world around it. Codey has an accelerometer to tell it which way is up (and down!), a light sensor to see when it is dark, and a sound sensor to listen for loud noises. Likewise, Rocky has a "proximity" sensor that detects when it is close to another object and a color sensor to recognize the color of nearby objects. We can use these sensors in our code to help Codey Rocky navigate its surroundings more intelligently.


  • Write obstacle-avoidance code that uses Rocky’s proximity sensor.
  • Practice troubleshooting when problems arise.
  • Use an "if-then-else" control structure to direct the execution of code.

Sensors and Equipment

This experiment features the following Vernier sensors and equipment.

Additional Requirements

You may also need an interface and software for data collection. What do I need for data collection?

Computer Science Teachers Association (CSTA) Standards

Compare and refine multiple algorithms for the same task and determine which is the most appropriate.
Create programs that include sequences, events, loops, and conditionals.
Test and debug (identify and fix errors) a program or algorithm to ensure it runs as intended.

Coding with Codey Rocky: Mission to Mars

See other experiments from the lab book.

1Houston, This is Codey
2Dance of the Martians
3Surviving the Desert of Mars
4Wild, Wild Mars
5Daily Life on Mars
6Surveying Mars

Experiment 4 from Coding with Codey Rocky: Mission to Mars Lab Book

<i>Coding with Codey Rocky: Mission to Mars</i> book cover

Included in the Lab Book

Vernier lab books include word-processing files of the student instructions, essential teacher information, suggested answers, sample data and graphs, and more.

Buy the Book

Go to top