/*******************************menu.c*********************************/ /* Anne Wright: Menu functions (which also allow variables to be set via the frob knob and selection buttons) for robot. 11/14/91 */ /* Modified file to support Handy Board, 5/11/96 */ /* Start button = choose, Stop button = escape */ /* Jeff Keyzer, jkeyzer@calweb.com */ /* abstractions for chosen_button */ #define NEITHER_B 0 #define START_B 1 #define STOP_B 2 /* abstractions for wait_button */ #define UP_B 3 #define DOWN_B 4 #define CYCLE_B 5 /*****************************button routines*************************/ int min(int a,int b) { if(a_array_size(choices)) n=_array_size(choices); coarseness=255/(n-1); /* printf("Selecting a string...\n"); */ /* msleep(500L); */ wait_button(UP_B); while(!(start_button() || stop_button())) { selection=(knob())/coarseness; if(selection!=last_selection) { printf("%s\n",choices[selection]); msleep(150L); last_selection=selection; } } if(wait_button(UP_B)==STOP_B) return -1; else return min(selection,n-1); return selection; }