menu 1 [scan-image] global [b-on] ; calls the main programs to scan-image initialize start-scan end ; initialize on-off variables, speed, direction, and picture size to initialize setpower 8 a, thisway b, thisway c, thisway setb-on 1 end ; start scanning at northwest corner of picture ; start stippling ; continues scanning rest of image to start-scan launch [start-stipple] loop [ if (b-on < 10) [b, thisway on waituntil [switch 10] b, off move-vertically b, thatway on waituntil [switch 9] b, off move-vertically] ] end ; moves motor a vertically to move-vertically ifelse (switch 8) [stop-scan] [a, onfor 10 a, off] end to stop-scan setb-on 10 b, rd onfor 10 a, thatway on waituntil [switch 7] a, off b, thatway on waituntil [switch 9] b, off ;stoprules end to start-stipple loop [ ifelse (b-on < 9) [adjust-stipple] [end-stipple] ] end ; determines darkness of image to image-darkness output sensor 0 end ; adjusts stippling speed to adjust-stipple say image-darkness if (image-darkness < 101) [resett] if (image-darkness > 100) [stipple 1] end to stipple :speed c, onfor 2 thisway c, onfor :speed thatway end to end-stipple c, onfor 2 thisway ;stoprules c, off end