Ashlee and Lizbeth's Vending Machine

We made a vending machine. Our main problem was finding all the right pieces. We ended up improvising on a few of the pieces. We also had to take off the bottom to reconnect two wires. Besides those mishaps the project came out just fine. The way it works is, you have to insert a coin (lego) either blue or yellow and push a button. Then whichever color you put in, that "flavor" would come out of the vending machine. Every time you insert a coin, the green light lights up and if the coin is yellow that light comes on and the sound generator makes an electronic sound. The same things happen with the blue coin, except that the blue light comes on and the blue "flavor" comes out of the vending machine.

Below is a picture and the programming.

TO YELLOW
TALKTO [MOTORA LAMPD SOUNDC]
SETLEFT
ONFOR 15
IF ANGLE6 <= -90 [STOP]
END

TO BLUE
TALKTO [MOTORB LAMPE SOUNDC]
SETLEFT
ONFOR 15
IF ANGLE7 <= -90 [STOP]
END

TO COIN
WAITUNTIL [TOUCH1]
TTO "LAMPF ONFOR 10
CHECK.COLOR
COIN
END

TO CHECK.COLOR
IF LIGHT8 >= 45 [YELLOW]
IF AND LIGHT8 >= 35 LIGHT8 < 45 [BLUE]
END

Vina Danks Home Page || Student Projects