Go Down

Topic: Vending machine with arduino Leonardo  (Read 886 times) previous topic - next topic

msaraya

Mar 21, 2016, 05:18 pm Last Edit: Mar 22, 2016, 11:39 am by msaraya
Hello,

For a school project, I'm trying to make a vending machine, similar to this one:
https://www.youtube.com/watch?v=IzD6wC8MlQw

I have the Servo Motor which turns 360 degrees and a PIR motion sensor, breadboard, and the Arduino Leonardo and cables and stuff. With all of this, I want to make a vending machine which will turn 360 degrees in 4 times when the PIR motion sensor detects a movement.
I want to put the PIR motion sensor on top of the vending machine, so when someone jumps or use their hands in front of the motion, the motor will turn 90 degrees. You have to move/jump/do something 4 times, so the vending machine's iron, where the candy is between it, will turn 360 degrees in total, so you receive your well-deserved candy.

I'm not very good with the code, but I guess I have to use an if/else statement, where you say; if the motion sensor detects motion, turn the motor 90 degrees. But, now I'm wondering how I do this four times a row, and how I connect the code of the motion sensor and the servo motor?

Can someone help me with this?



sistemasymicros

Is it absolutely neccesary use the PIR?

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy