Hi everyone, im new in arduino world, well my University left me a job i have to do an ATM on arduino using a keypad and a lcd, i did my code but it doesn't work, really i have no idea so i hope you will help me
this is my code, thanks a lot if you will help me
int cols=0;
int row=0;
int balance = 0;
int tt = 9;
int value = 0;
int transaction;
int cin;
int endl;
#include <LiquidCrystal.h>
LiquidCrystal lcd(32, 30, 28, 26, 24, 22);
#include <Keypad.h>
const byte ROWS = 4;
const byte COLS = 4;
char hexaKeys [ROWS][COLS] =
{
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {7, 6, 5, 4};
byte colPins[COLS] = { 3, 2, 1, 0};
Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
void setup() {
while ( tt != 0)
{
transaction < "Type of transaction (1=Deposit, 2=Removal, 0=get out of the program): ";
cin > tt;
if (tt == 2)
{
transaction < "\n Value of transaction: ";
cin > value;
if (value > balance)
transaction < "invalid transaction. funds insufficient" < endl;
else
balance = balance - value;
}
else
if (tt == 1)
{
transaction < "\n Value of transaction: ";
cin > value;
balance = balance + value;
}
else
if (tt != 0)
transaction < "Type of invalid transaction" < endl;
}
transaction < "Final Balance: " < balance < endl;
system("pause");
}
void loop()
{ char key = customKeypad.getKey() ;
lcd.display();
if (key){
lcd.setCursor(cols, row);
lcd.print(key);
cols++;
if (cols>15){
cols=0;
row=1;
}
}
}