Coin Slot to Arduino... Need Help. What to do? Answered
Hey guys, been doing one of the project in instructables w/c is this
Interfacing a Coin Slot to a Arduino. Read and done the instructions provided in the project. But there seems to be a problem bec. i can't seem to get the desired output.
I have a Coin Slot w/c was already set to 3 different types of coins (P1, P5.00, P10.00)(Philippine Coins)
Set it up according to the instructions of the project, "COIN" white wire connected to pin2 (interrupt pin 0) of the arduino, common ground connection of the arduino and the coin slot (12V), and for an easy way to see the output i put up 3 LEDs on pin8, pin9, and pin10.
This is the code i used, (modified)(original comments still there)
const int coinInt = 0;
//Attach coinInt to Interrupt Pin 0 (Digital Pin 2). Pin 3 = Interrpt Pin 1.
volatile float coinsValue = 0.00;
//Set the coinsValue to a Volatile float
//Volatile as this variable changes any time the Interrupt is triggered
int coinsChange = 0;
int OneLed = 8;
int FiveLed = 9;
int TenLed = 10;
//A Coin has been inserted flag
//Start Serial Communication
attachInterrupt(coinInt, coinInserted, RISING);
//If coinInt goes HIGH (a Pulse), call the coinInserted function
//An attachInterrupt will always trigger, even if your using delays
//The function that is called every time it recieves a pulse
coinsValue = coinsValue + 1;
//As we set the Pulse to represent 5p or 5c we add this to the coinsValue
coinsChange = 1;
//Flag that there has been a coin inserted
if(coinsChange == 1)
//Check if a coin has been Inserted
if (coinsValue == 1)
else if (coinsValue == 5)
else if (coinsValue == 10)
//Print the Value of coins inserted
coinsChange = 0;
Rather than using microsoft express, i wanted to use simple LEDs on pin8, pin9, and pin10 to indicate if the program read the input correctly.
after doing the wiring, and coding in the arduino, i tested to see if it would work.
NONE of the LEDs light up after inserting coins on the coinslot.
Need Help! :X