Programming
Now we need to write a program that makes this smart tank move. We will be using EV3-G, the graphical programming language designed for the EV3.
Setting up the program
Before we start to write the program, we need to assign port numbers to both of the IR sensors. The program makes use of both of the IR sensors on the robot. The IR sensor that is mounted to the robot's chassis is plugged into port 1
, so we will refer to this sensor as IR 1. The sensor mounted to the turret is plugged into port 2
, so we will refer to that sensor as IR 2. It is imperative to remember this because the program identifies these sensors using their port numbers. We use the port numbers to tell the robot which sensor to check at any given time.
Now that we have established the numbers we will use to identify the sensors, we can start writing the program!
The first block we will add into our program is a loop block. By default, its condition will be set to repeat infinitely. Since that is what we want, there...