I recently started working with the Vision Sensor. My class and I have not yet used the Vision Sensor, and are trying to figure out how to use it.
The program I have (at bottom) is based on a document at this link. https://education.vex.com/xyleme_content/vision-sensor-v5/pdf/vision-sensor-v5.pdf
It is supposed to just take a Snapshot and then report whether or not it sees the red object. However, when I run the program, the robot never sees the object, even when the window to configure the sensor shows that it can.
Is there a problem in my program which causes the robot to fail to see or to recognize the red object? If there is, what would I need to do to fix it?
void redCallBack(){
Brain.Screen.clearLine();
VisionSensor.takeSnapshot(VisionSensor__SIG_RED);
if(VisionSensor.objectCount>0){
Brain.Screen.print("Red Object Found");
Brain.Screen.newLine();
}
else{
Brain.Screen.print("No Red Object Found");
Brain.Screen.newLine();
}
}
int main() {
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();
while(true){
redCallBack();
wait(1,seconds);
}
}