;; Code to help test sensors global [black] menu 1 [initialize] menu 2 [show-sensors] menu 3 [go-until-black] menu 4 [black+10] menu 5 [black-10] to show-sensors loop [ top type [l:] ifelse sees-black? left-sensor [type [black]] [type [white]] type left-sensor print [-] bottom type [r:] ifelse sees-black? right-sensor [type [black]] [type [white]] type right-sensor print [-] ] end to go-until-black go-straight waituntil [or sees-black? left-sensor sees-black? right-sensor] stop-motion beep end to turn-left left-wheel off right-wheel on thisway end to turn-right right-wheel off left-wheel on thisway end to go-straight left-wheel on thisway right-wheel on thisway end to stop-motion left-wheel off right-wheel off end to sees-black? :sensor-value output :sensor-value > black end to left-wheel a, end to right-wheel b, end to left-sensor output sensor 0 end to right-sensor output sensor 1 end to front-bumper? output switch 7 end to back-bumper? output switch 8 end to black+10 setblack black + 10 printblack end to black-10 setblack black - 10 printblack end to printblack type [black=] print black end to initialize setblack 100 ; default threshold left-wheel setpower 8 right-wheel setpower 8 printblack end