Rescuer Learn 2: Installing the Distance Sensors
This is the third challenge within the Robotics with GoPiGo and Python Curriculum.
Your task is to design a robot program that can navigate through the maze-like jungle without trampling over any plants or getting stuck in any dead ends.
Learn how to use the Distance Sensor and practice using the left-hand rule of maze-solving.
6. Sensor Testing - init
Let’s now write some code to test that our sensors work and learn how to use them.
To test the distance sensors, you will write some code to repeatedly take sensor readings for 30 seconds, reporting the values read as they happen.
Let’s record the start time of our program.
- Within the empty init() function in the Variable Initialization cell, declare a start_time variable.
- Assign the result of an initial time check to it.
- Let’s also declare and set up empty value lists ready for the left-facing and front-facing distance sensors to store their readings in. We will call these left_values and front_values.