Hi, I'm new to arduino and trying to set up a keypad and display. I have a code to get the keypad working in the serial monitor and a code to display text on my Waveshare 1602 rgb display. But i cant for the life of me get the display to show the numerical values from the keypad. It is either telling me the waveshare library doesnt recognize a command, or it displays a strange ""EE=FEE" type of writing
And how are we supposed to solve this without seeing your code and setup?
You will need to show a wiring diagram with all the devices connected, the sketch you are using, a description of how you expect the sketch to run.
#include <Waveshare_LCD1602_RGB.h>
#include <Wire.h>
#include <Keypad.h>
Waveshare_LCD1602_RGB lcd(16, 2);
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] = {5, 4, 3, 2};
byte colPins[COLS] = {9, 8, 7, 6};
Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
void setup(){
Serial.begin(9600);
lcd.init();
delay(1000);
lcd.setCursor(0, 0);
lcd.send_string("Insert Value");
delay(2000);
lcd.clear();
}
void loop(){
char customKey = customKeypad.getKey();
delay(1000);
if (customKey){
lcd.send_string(customKey);
}
}
I do not know this library. But does lcd.send_string expect a C-string as argument?
If so: your char is not a C-string. It has no final '\0'.
Is there a lcd.send_char function available in the library?
Youre my hero, swapping it to lcd.send_char fixed my issue. Thank you so much!
Good to hear it works!
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.