;; Tom Day 2

;; programming by Katie last modified on 1/24/01

global [roomlight time carpet flashlight white]

to initialize
print "initialize
setcarpet seeline
end

;;programs

to tom
initialize
wait 1200 light-on
loop [touch? seeline?]
end

to run
print "run
wheels on thisway
end

to stopwheels
print "stopwheels
wheels off
end

to backup
print "backup
wheels on thatway
end

;;motors

to wheels
c, 
end

to light
ab, 
end

;;lights

to light-on
print "light-on
light on
end

to light-off
print "light-off
light off
end

to touch? 
waituntil [(touch)] waituntil [not (touch)] light-off wait 100 c, setpower 7 run
end

to seeline?
waituntil [(carpet - seeline) > 40] stopwheels
end

;; sensors

to touch
output switch 7
end

to seeline
output sensor 0
end

control buttons =
tom
run
light-on
light-off
tom

control box =

print 5
beep
waituntil [switch 7] beep
waituntil [timer > 1000] beep