Void value not ignored as it should be?

2 replies [Last post]
TheClaymore
Title: NooBot
Joined: 12/06/2013
Posts:
BotPoints: 26
User offline. Last seen 7 years 28 weeks ago.

Noob here, so this code is returning "Void value not ignored as it should be", but I don't understand why, because I never declared anything void. Any help would be appreciated.

// Set up a camera configuration that is calibrated so that it recognizes
// a red colored object for color channel 0 before running the program
// and make sure that configuration is the default
int main() { // Start up the camera and specify the resolution
camera_open(LOW_RES);
int x, y, color=0; // set up for color channel 0 (red)
printf("Looking for Botguy\nPress A when ready\n\n");
printf("Press B button to quit\n");
while(ao(5000) ){
motor(1,50);
motor(3,50);
}
while (a_button() == 0); // wait for A button
while (b_button() == 0){ // run till B button is pressed
camera_update(); // process the most recent image
if (get_object_count(color) > 0){
//get x, y for the biggest blob the channel sees x = get_object_center(color,0).x;
y = get_object_center(color,0).y;
printf("I see Botguy\n",x,y);
ao();
motor(2,50);
msleep(5000);
ao(5000);
break;
}
else{
motor(1,50);
motor(3,50);

}
msleep(200); // give user time to read
}
printf("Program is done.\n");
return 0;
}

//Fixed one of the errors from TF3, but it still has "Void value not ignored as it should be", but I don't know why or where, because we don't declare anything void.

Marty Rand
Marty Rand's picture
Title: Botball Youth Advisory Council
Joined: 07/04/2009
Posts:
BotPoints: 253
User offline. Last seen 8 years 6 weeks ago.

I believe the issue is in "while(ao(5000) ){"

ao() returns a void therefore you cannot have it in a while statement. Also, ao() doesn't have any arguments. I don't know where the 5000 came from, but that shouldn't be there.

In future help requests please post the line number of the error.

-Marty Rand
{
Senior programmer at Norman Advanced Robotics

Former senior programmer at Whittier Middle School

Youth Advisory Council

All around nerd
}

TheClaymore
Title: NooBot
Joined: 12/06/2013
Posts:
BotPoints: 26
User offline. Last seen 7 years 28 weeks ago.

Alright thanks, will do.