Hello,
i am having trouble displaying all of the numbers to the second row of the LCD. I put this in my code:
lcd.setCursor(0, 1); // bottom left but it only displays the numbers one at a time.
How do you fix this?
Thank you
#include <LiquidCrystal.h>
#include <Keypad.h>
LiquidCrystal lcd(22,24,26,28,30,32);
const byte ROWS = 4; // Four rows
const byte COLS = 4; // Four columns
char keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = { 5,4,3,2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = { 9,8,7,6}; //connect to the column pinouts of the keypad
// Create the Keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
lcd.begin(16,2);
}
void loop() {
char key = keypad.getKey();
if (key) {
lcd.setCursor(0,1);
lcd.print(key);
}
}