I use Mark Stanley keyboard library and Alexangre Brevid in my program for my 4x4 keyboard it works fine now I will add the following functionality:
| -----> Use one of the buttons to move the cursor to the left.
| -----> Another to move the cursor to the right.
| -----> Another to erase the entries.
| -----> Another to validate.
| -----> And another to clean the entire screen.
How can I do this?
Cordially!
Here is my code:
#include <SPI.h>
#include <LiquidCrystal_I2C.h>
#include <Keypad.h>
LiquidCrystal_I2C lcd(0x27,16,2);
/*Le Clavier*/
const byte numRows= 4;
const byte numCols= 4;
char keymap[numRows][numCols]= {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
byte rowPins[numRows] = {5,4,3,2};
byte colPins[numCols] = {9,8,7,6};
//initialiser le clavier
Keypad myKeypad= Keypad(makeKeymap(keymap), rowPins, colPins, numRows, numCols);
void setup() {
//Initialiser l'ecran LCD
lcd.init();
lcd.backlight();
SPI.begin();
lcd.print("Entrez le");
lcd.setCursor(0,1);
lcd.print("montant");
delay(3000);
lcd.clear();
}
void loop() {
char keypressed = myKeypad.getKey();
if (keypressed != NO_KEY){
lcd.print(keypressed);
}
}