Step 4

Program Setup


First, let’s create a variable to help us out. A variable is a way to store a number, here we are going to make one called “limit”.

We will use this “limit” variable to save the maximum distance an object can be for us to drive towards it.

Once we create this variable, add the code as shown.

Next, we need to add code to have our robot drive around within the boundaries of the map, move onto the next page when you are ready to see the solution to this. Try and figure it out yourself first! The solution should be very familiar.