/* Simple forward for sumo with light sampling control of start; 3/9/02 assumes RCX with light sensor in port 2, motors on #A & C. view button sets threshold value Added begin and end display 1/20/03 tlg*/ void main() { int threshold = 600; printf("sumo1");sleep(3.); while(1) { while(prgm_button()==0){ while(view_button()==1){ threshold += 5; printf("%d=t\n",threshold); if(threshold > 750){threshold = 600;} sleep(.4); } printf("Press"); sleep(.4); printf("Prgm"); sleep(.7); printf("%d\n",light(2)); sleep(1.0); } while(light(2)> threshold) { printf("<%d?\n", light(2) ); sleep(.15); } beep(); /* actual sumo code goes here: fd(A); fd(C); sleep(5.0); /* run for 5 seconds */ off(A); off(C); printf("done");sleep(4.); } }