Hello Everyone. I am a first time, long time. This has been done and talked about many times, but I cannot figure out how to code a CH926 coin machine.
I am trying to program a the CH926 coin machine to accept 2 quarters and turn on a blower, lights, etc, for 3 minutes. It is code for a .50 cent air hockey table.
What I know:
I know how to do everything (relays, programming the coin machine etc.)
What I don't know/Having trouble with:
I cannot figure out how to program the Arduino correctly. I have viewed many sites and this is what I have come up with:
const int coinInt = 0;
volatile float coinsValue = 0.00;
int coinsChange = 0;
int ledPin = 13;
attachInterrupt(coinInt, coinInserted, RISING);
coinsValue = coinsValue + 0.25;
coinsChange = 1;
if(coinsChange == 2)
coinsChange = 0;
if(coinsValue >= 0.50)
delay(1 * 60 * 1000);
I don't understand all of it (like RISING), but most of it seems logical (as far as Arduino coding goes).
How can I simulate this in TinkerCAD (Circuit)? I don't think I am doing the pulse part right. I am just hooking up a switch with 5v to act as a "pulse" from the coin machine. (of course, since my coding is wrong, none of that works).
Thanks in advance and be gentle, I am still learning