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;
}
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?
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
please just send me a new code.