The sensor readings detect the presence of walls in front and to the sides of the robot, this information is then fed into the arduino, which determines which of the two motors to turn on to avoid (turn away) or find (turn into) the wall. The arduino "sees" a wall if the sensor reading is below a defined value that is calibrated for each sensor.
The robot initially starts out moving in a straight line until it sees a wall, and an integer is stored that tells the arduino which side of the robot the wall should be located. If a wall is seen, the arduino turns on the motor closest to the wall, turning the robot away from the wall. If no wall is seen, the arduino uses the wall integer to turn the robot back towards the wall. When a wall is seen in front of the robot, it uses the wall integer to determine which way to turn to avoid collision.