Madame Lucy
The Amazing Fortune-Telling Goose
Natalie Levinson '09 & Christina Miller '08
The Coin Sensor
Inserting a coin into the box started Lucy's fortune telling routine.
Process:
Construction 
We constructed the box with scraps of cardboard and duct tape, then covered it in fabric and construction paper. A reflectance sensor is taped on the interior of the box, facing the coin slit. When a coin passes through the slit, the reflectance sensor detects it and the fortune-telling process begins.

The inside of the coin box showing the reflectance sensor and the sloped bottom.
Code 
The sensor was set up with auto-thresholding to ensure it would work regardless of any change in light environment.
Here are the sections of our code that ran the coin sensor:
menu 1 [initialize]
menu 2 [accept-coin]
global [coin-threshold change-coin shiny egg-dropped?]
to initialize
setcoin-threshold (coin-sensor)
setchange-coin 20
setshiny 110
end
to accept-coin
loop [
waituntil [not coin?]
waituntil [coin?]
wait 10
tell-fortune
]
end
to coin?
ifelse ((coin-threshold - coin-sensor) > change-coin)
[output 1]
[output 0]
end
to coin-sensor
output sensor 0
end |