Step 6

Completing the challenge


After we reverse, we tell our robot to turn right.

We have it keep turning until the distance sensor detects an object within the range we gave it.

As soon as an object is detected, we turn right an extra 2 degrees to turn a little closer to the object, then the loop repeats and we drive forward until we hit a red line.

Once you have this done, go ahead and test it out! See how it performs on the different maps. (Remember to reset the map, click on the circular arrow icon)

Are there any other ways you can think of programming/solving this program, try them out and see if they work! There are also a few ways this program can be improved, see if you can figure them out!