Please help with Bill acceptor project
code: [select]
http://i058.radikal.ru/1406/0d/46b487b9968b.jpg
my arduino project :
bill acceptor nv9 -1 button + 1 led , 1 realy
1)
when accept - 3,4,5,6 dollar
allow open -button + flash(led1) indicated - ready open( valve on relay)
relay timer - 1 minute open( valve on relay)
after 1 minute - close , reset arduino
2)
when accept - 10,11,12,13 dollar
allow open -button + flash(led1) indicated - ready open( valve on relay)
relay timer - 3 minute open( valve on relay)
after 3 minute - close , reset arduino
#include <wire.h>
#include <liquidcrystal_i2c.h>
const int relaypin = 4;
const int switchpin = 7;
liquidcrystal_i2c lcd(0x27,16,2);
volatile byte cashcount = 0;
volatile byte bored = 0;
void setup()
{
pinmode(switchpin,input);
pinmode(relaypin,output);
digitalwrite(switchpin,high);
digitalwrite(relaypin,high);
lcd.init();
lcd.backlight();
serial.begin(9600);
attachinterrupt(0, caching, falling);
delay(3000);
cashcount = 0;
}
void caching()
{
cashcount++;
}
void loop()
{
{
digitalwrite(switchpin,high);
digitalwrite(relaypin,high);
}
bored = cashcount;
if (cashcount == 0){
serial.println("you have no grina!");
hanginaround();
} else {
serial.print("you have ");
serial.print(cashcount);
serial.println(" grivna.");
lcd.clear();
lcd.setcursor(0,0);
lcd.print(" not love grivna");
lcd.setcursor(2,1);
lcd.print(cashcount);
}
hanginaround();
}
void hanginaround(){
if (bored != cashcount){
return;
} else{
hanginaround();
}
}
code: [select]
void hanginaround(){
if (bored != cashcount){
return;
} else{
hanginaround();
}
}
recursion?
big, big no-no.
Arduino Forum > Using Arduino > Programming Questions > Please help with Bill acceptor project
arduino
Comments
Post a Comment