need help programing demobot to find color also if possible to search for more then more colors at once please tell me

2 replies [Last post]
ryanneedshelp
Title: NooBot
Joined: 04/11/2012
Posts:
BotPoints: 0
User offline. Last seen 10 years 23 weeks ago.

hello my name is ryan i have a bot ball tornament on satuarday so please send me a program that can look for colors and go towards it.program below.

int main()

{

int x ;
int red,yellow,blue =1;

printf("follow red cube,then yellow cube,and then blue cube\nB to end\n");

while(b_button()==1) {

track_update();;//get new image

if (track_count(red ) > 1){

x = track_x(red,yellow,blue//cubes

green, 1);//biggest pink blob

mav(0,500+5*(80-x));

mav(3,500+5*(x-80));

sleep(.2);

else{//slowly spin

}
{
mav(0,500);

mav(3,-500);

printf("Looking for red,yellow,blue\n");

sleep(.2);

printf("Finished\n");

return 0;

}

Jeremy Rand
Jeremy Rand's picture
Title: Botball Youth Advisory Council
Joined: 04/03/2009
Posts:
BotPoints: 1168
User offline. Last seen 7 years 18 weeks ago.

  1. x = track_x(red,yellow,blue//cubes
  2.  
  3. green, 1);//biggest pink blob

Do you realize that red and yellow aren't initialized, and green isn't even declared in your code? Have you read the track_x documentation in the KISS-IDE manual?

  1. while(b_button()==1) {

This will loop while the B button is pressed. My guess is that you intended for it to stop when the B button is pressed. If that's the case, then you should use != (not equal to) instead of == (equal to).

-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS

ryanneedshelp
Title: NooBot
Joined: 04/11/2012
Posts:
BotPoints: 0
User offline. Last seen 10 years 23 weeks ago.

please just send me a new code.