advance global [ color ] ;------------------------------------------------------------------- ; This procedure sends a ball from the hopper ; into position to be scanned by the color reader ;------------------------------------------------------------------- to startup setpower 3 thatway a, on waituntil [ sensora < 150] off end ;------------------------------------------------------------------- ; When called, this procedure releases a single ; ball from the waiting/color reading position. ;------------------------------------------------------------------- to advance ; Make sure there is a ball at the waiting position startup ;Read its color bsend $180 wait 1 setcolor bsr 1 ; beep to tell the color repeat color [ beep wait 4] ; pass that ball out... setpower 8 thatway a, onfor 1 ; if there isn't a ball behind this one, advance ; until the next ball is in place if sensora > 150[startup] end