ea123, you're correct, changing the type from int to long gives me this output:
0
264757
536961
810508
1084856
1359367
1634125
1908568
So the negative numbers were a type problem. But the thing is it keeps adding a line every 3 seconds even when i don't insert a bill. The signal is always falling, all the time.
I changed the hardware setup and put the pulse wire directly into the arduino input (pin 2). The signal keeps falling too. Here's the output on serial monitor:
16
1044757
2088158
3112505
4138586
5160061
6171990
Then I put back the original hardware setup with the pull up and changed the interrupt from FALLING to RISING. Same thing, outputs a large amount of rising in the signal. Here's the serial monitor:
0
272457
543522
810879
1081617
1351859
1619289
1883967
Lastly, tried changing from RISING to LOW. Same thing, a lot of interrupts even when a bill is not inserted. Here's the output:
0
162041
323906
485392
647142
809346
Rechecked again the hardware setup, and is exactly like the diagram you drew.
What's going on?
Thanks in advance.