Hello! I need your advice. My code sometimes count only 1 coin, sometimes counts double 1 peso coin and always after 1 coin inserted this don t count anymore.
I need to be able to receive on serial monitor credits inserted and total amount each time a coin is inserted.
I have a little trouble to inderstand millis and pulses time. i m connecting coin pin to d2 of arduino nano,,
Also I have connectd my nano to a timer so each time a coin is received a timer starts, don t know if it makes noise or it don t affect because they are separate. `
¿Can you help me please? Thanks in advance!
ever work correctly if "pulse" always has value 0 ?
I tried to find your declaration of "pulse" and had to go a huge number of occurences of the letter-sequence "pulse"
25 occurences to the letter-sequence "pulse" in your code
But you did not declare it. The compiler did not complain because it is a predefined word.
But is something really different than what you thought.
As a general advice give everything unique and self-explaining names.
one way is to add "my" to everything that you declare
myPulse
my....
pulse : what kind of pulse? input? or output? which one (there might be more than one thing that is "pulsing"
For analysing and debugging your code add serial printing in various places to see the real numbers / values that are there
One important thing to learn is: writing very precise descriptions.
what kind of reset?
manually reset ?
power Off/On cycle of the microcontroller?
reset after a certain time?
reset after inserting coins for "one case" has finished?
total number of allcoins that have ever been detected?
For answeing these questions you should give an overview about your project.
And a detailed description of the wanted behaviour written in normal words
Best method to so do is describing a typical use of your device with ALL details
You should provide datasheets of all used hardware-components
It is also important to learn the basics of C++-programming
Take a look into this tutorial:
It is easy to understand and has a good mixture between explaining important concepts and example-codes to get you going. So give it a try and report your opinion about this tutorial.
Presumably there's some other buttons pressed to purchase (?) something. either there's a sufficient # of coins and the purchase is accepted, or it is not accepted, but there may be sufficient coins for some other item
coin telephones had a button to pressed to release the coins. Not knowing how your machine works i Just used a timer to reset the coin count.
Thanks youSir! it s personal project just trying to know what are the sales of my machine (the machine work and recevie money by itself.. i m adaptting this to coin acceptor and see sales online, thanks for your help!
Thank you Sir! Ill study it ! this is a personal project with my machine to see sales of coin acceptor on the web. I know there are somethings and services that give this information.. but i m trying to do it my myself.