Arduino vending machine project

xxxx

Sounds like an interesting project.
What is the camera for?
You can find motors & power supplies here www.mpja.com
You will need some relays or MOSFETs to control power going to the motors.
Instead of a tact switch, a microswitch, the kind that has an arm on it, may be easier to mount and adjust.

THanks for the info. And the camera is for people who try to cheat or vandalize the machine.

Does anyone know of a sketch that could achieve what I want?

I don't know about a sketch, but maybe some paragraph breaks in the description of the problem might encourage me to read it.

I'm assuming you're thinking of a sketch like a drawing. I mean the arduino sketch like a program.

I'm assuming you're thinking of a sketch like a drawing

I know what an Arduino sketch is, I just can't read the statement of the problem.

Ok I will fix it.

It is fixed.

I probably have to run a wire from the 5v rail of the breadboard to the switch and then back to an analog pin on the arduinio, right?

I kind of have this figured out. I need to run a wire from the 5v rail to an analog input pin on the arduino. Then I need to have a wire from another analog pin to a MOSFET gate pin. Connect the + terminal of the 12v power supply to the MOSFET source pin. The connect a cable to the drain pin of the MOSFET to the motor. Then wire the - terminals together. Now the only thing left is the sketch. Where should I start?

Your last post addresses a motor driver.
This is the circuit you want for that, using an N channel logic level MOSFET. The MOSFET will turn the motor on when the arduino pin it is connected to is high (can be any of the pins, with digitalWrite (pinX, HIGH); to turn it on & digitalWrite(pinX, LOW); to turn it off.
The second diagram shows typical ways of connecting switches & LEDs to receive inputs & have user indicators.
There are plenty of tutorials available that show the bacics of a sketch, do a little reading & try one, then post again with questions.

Thanks for the diagrams. I have plans to build an arduino from http://www.instructables.com/id/Build-Your-Own-Arduino/

I finished the sketch. Here it is:

/*
Arduino vending machine program
*/

int mosfetPin = 8;
int coinPin = 7;
int val;

void setup() {
pinMode(mosfetPin, OUTPUT); // Set mode of pin to output
pinMode(coinPin, INPUT); // Set mode of pin to input
}

void loop() {
val = digitalRead(coinPin); // Read input value and store it in val
if (val == LOW) { // Check if the coin hit the microswitch
digitalWrite(mosfetPin, HIGH); // Activate the mosfet gate
delay(5000); // Allow the motor to run enough to complete task
digitalWrite(mosfetPin, LOW); // Stop motor
}
}

Please check out my sketch and try to point out any flaws.

digitalWrite(8, LOW);

You defined a nice name for pin 8 - why not use it?

(it may also help if you redefine the nice name as a "const")

It was just an error I made when I coded it. I will change the code.

Pictures!

I want to see what this monster looks like.

Not finished yet but will post when Im done!

I would recommend a C120 coin mech or a Klingon credit board.

The C120 is great and can be programmed to whatever credit you want your product vended at, the Klingon credit board is the same but is better if you want to design your own coin entry mechanism.

I'm an ex-engineer from arcades and these two things are perfect.

AeroNotix:
I would recommend a C120 coin mech or a Klingon credit board.

The C120 is great and can be programmed to whatever credit you want your product vended at, the Klingon credit board is the same but is better if you want to design your own coin entry mechanism.

I'm an ex-engineer from arcades and these two things are perfect.

Definitely not getting one of those. At their way too expensive.