/* place your #defines and global variable declarations here */ void program() { /* declare your variables here */ int c; /* your program goes here */ open(); sleep(2.0); c=closed(); if(c==1){printf("Closed on object\n");height(3);} if(c==2){printf("Closed completely\n");return;} } /* put your functions and subroutines here */ void open() {motor(1,20); while(digital(9)==0){} motor(1,0);} void height(int n) {int h=(n-1)*10+205; while(h>analog(3)){motor(3,-60);} while(h_array_size(choices)) n=_array_size(choices); coarseness=255/(n-1); while(!(stop_button() || start_button())) { selection=(knob())/coarseness; if(selection!=last_selection) { printf("%s\n",choices[selection]); sleep(0.1); last_selection=selection; } } if (start_button()) { return selection * 2 - 1; } else { return selection * 2; } }