I saw that, i got that code, but i want to replicate the piggy bank with the lcd display, but using the 4 coin acceptor.
I'm assuming some part of that code will insert after the pulse length.
what i'm having trouble with is how to assume 1, 2, 3, or 4 pulses and than the display showing various amounts to be added. The current code assumes equal values of 25.
Coin values:
1 = .01 (penny)
2 = .05 (nickel)
3 = .1 (dime)
4 = .25 (quarter)
*/
const byte coinValues[4] = {
.01, .05, .1, .25}; //Coin values goes into this arrayWhere do I fit (adjust if necessary) the above code into the code below?
And again, how do i adjust it to add various amounts for a total?
while (digitalRead(COIN)) {
delay(1);
counter++;
}
Serial.print(counter);
Serial.println(" ms long pulse");
if ((counter > 60) || (counter < 20))
return;
coins++;
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" OINK OINK! ");
lcd.setCursor(0,1);
lcd.print("YOU HAVE $");
lcd.print(coins*.25);
lcd.print(" ");
// loop through to flash the LED(please remember I am totally new at this so please no "do a search stupid or take a class first") I have read getting started with Arduino and other books and i can totally make an led blink!!!