Hello guys, I'm new to the forum and don't know if this post is in the right place, hope it is.
First of all, my english is not very good, so sorry for that.
I have to do a vending machine with arduino, I already have the different components and I'm trying the code I did but it doesn't work.
I will try to explain how it works (the vending machine):
First, the machine will show in the display a message (Press a boton). Then we press one of the botons (there are just 2). The display shows the money to insert. We insert it and then the product falls down. It only works that way.
Now I will try to explain the code:
First I put the setup for everything to work ok. The loop funciont just puts the first and last display messages, sets values for the next functions and tells them which product must fall down. The function dirua is the "main" function. It makes sure that the money inserted is correct for that product and if it is, that product will drop. Next the function zorroa, is the one that makes sure the coinselector takes the right pulses, dont really know if it has to have a while to always give an answer as I stated there in the code. Last I have two other functions, one for the coinselector to count the pulses, and other one to show messages in the display.
Feel free to ask any question.
Thanks in advance.
EDIT: When I load the program, the display shows to press a buton, I press it, and it stops in the message "Insert X". I insert that coin but it doesnt get it so I guess the error is in function zorroa (as the coinselector is working well).
Junto03.ino (2.92 KB)