Question about writing a program that moves a robot based on the position of an object

I am not sure how much you have accomplished with your program but here are some links to information on the Vision Sensor.

The sensor will return a value called centerY that you can use math to determine if the robot should turn left or right.

//JPearman example
   int TARGET = 150; 
   int error = obj.centerY - TARGET;  //How far off center is the item.

      // simple P control with a limit of 50
     int drive = error;
     if( drive > 50 ) drive = 50;
     if( drive < -50 ) drive = -50;

     // object is found and centered
     if( obj.centerY > (TARGET-15) && obj.centerY < (TARGET+15) ) {
       driveTurn(0);
     }
     else {
       driveTurn( drive );
     }
3 Likes