Vision Sensor Sensing in Config but not in Code

I’ve just started trying to use a vision sensor to get more accurate alignment during skills auton, and the vision sensor just doesn’t seem to be detecting any objects.

In the configuration window, it will put a bounding box over the correct objects, so I’m pretty sure it’s correctly tuned, but when I use this code, it never reports any objects.

void usercontrol(void) {
  while(1){
    vis.takeSnapshot(vis__YELLOWBASE);
    Controller1.Screen.clearScreen();
    Controller1.Screen.setCursor(1,1);
    Controller1.Screen.print(vis.largestObject.exists);
    wait(100,msec);
  }
}

So the question is: What am I doing wrong, and how can I get this vision sensor to stop misbehaving?

For anyone else who might be having this problem:

The vision sensor won’t send values to the Brain while it’s plugged into the computer (i.e. you physically can’t get it to show the bounding boxes on the config screen and have it send values to the robot at the same time.)