NEED HELP. 12C LCD Display not working

I'm using the freenove 12C LCD (new version) and cannot get it to work. I am using the hd4480 library by Bill Perry, and I have done his 12CexpDiag, attached is the serial monitor result when I run the sketch, and my wiring layout. My LCD is lit up but does not display anything.

Hi and welcome to the forum.

Please check your wiring. As far as I can see, it looks like you have the I2C signals backwards.

SDA should be on pin A4
SCL is pin A5

In either case, please post the sketch you are using that doesn't work. use the <CODE> button in the message composition window toolbar and

type or paste code here

paste your code where it sez.

a7

Hi, thank you. This did fix the problem - the sketch I used was a diagnosis test by the library author. You can find it here.

I do now have a separate issue - when viewing others codes they use
#include <LiquidCrystal_I2C.h> , however this appears to not work for my code as it 'cannot detect' it.

Modify new/imported code to use hd440 library syntax.

You have a working example for your LCD. Write your code using the same patterns as you see when you read the working example.

If you are stealing borrowing other code, it will be as @Railroader says - you'll have to come to enough of an understanding of that code to modify it to use the library the example code uses.

Or you could try modifying the example code that works to use the library in the code you found somewhere and want to use.

Either way, nothing like this is as easy as it seems like it should be. I'd bet you could get your LCD working with just about any good library.

Now… please post the code you are trying to get working.

a7

Here is the code.

#include <Keypad.h>
#include<EEPROM.h>
#include <Wire.h> 

#include <hd44780.h>
#include <hd44780ioClass/hd44780_I2Cexp.h>
hd44780_I2Cexp lcd;


char password[4];
char initial_password[4],new_password[4];
int vcc=11;
int i=0;
int relay_pin = 11;
char key_pressed=0;
const byte rows = 4; 
const byte columns = 4; 
char hexaKeys[rows][columns] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};

byte row_pins[rows]={2,3,4,5};
byte column_pins[columns]={6,7,8,9};
Keypad keypad_key=Keypad( makeKeymap(hexaKeys),row_pins,column_pins,rows,columns);

void setup(){
lcd.begin();
lcd.backlight();
pinMode(relay_pin, OUTPUT);
pinMode(vcc, OUTPUT);


lcd.print(" MOUNT DYNAMICS ");
lcd.setCursor(0,1);
lcd.print("Electronic Lock ");
delay(3000);
lcd.clear();
lcd.print("Enter Password");
lcd.setCursor(0,1);
initialpassword();
}
void loop(){
digitalWrite(relay_pin,HIGH);

key_pressed = keypad_key.getKey();
if(key_pressed=='#')
change();
if (key_pressed)
{
password[i++]=key_pressed;
lcd.print(key_pressed);
}
if(i==4)
{
delay(200);
for(int j=0;j<4;j++)
initial_password[j]=EEPROM.read(j);
if(!(strncmp(password, initial_password,4))){
lcd.clear();
lcd.print("Pass Accepted");
digitalWrite(relay_pin,LOW);
delay(2000);
lcd.setCursor(0,0);
lcd.print("Pres >START< to");
lcd.setCursor(0,1);
lcd.print("change the pass");
delay(3000);
lcd.clear();
lcd.print("Enter Password:");
lcd.setCursor(0,1);
i=0;
}
else{
digitalWrite(relay_pin, HIGH);
lcd.clear();
lcd.print("Wrong Password");
lcd.setCursor(0,0);
lcd.print("Pres >#< to");
lcd.setCursor(0,1);
lcd.print("change the pass");
delay(2000);
lcd.clear();
lcd.print("Enter Password");
lcd.setCursor(0,1);
i=0;
}}}


void change(){
  int j=0;
lcd.clear();
lcd.print("Current Password");
lcd.setCursor(0,1);
while(j<4){
char key=keypad_key.getKey();
if(key)
{
new_password[j++]=key;
lcd.print(key);
}
key=0;}
delay(500);

if((strncmp(new_password, initial_password, 4))){
lcd.clear();
lcd.print("Wrong Password");
lcd.setCursor(0,1);
lcd.print("Try Again");
delay(1000);}

else{
j=0;
lcd.clear();
lcd.print("New Password:");
lcd.setCursor(0,1);

while(j<4){
char key=keypad_key.getKey();
if(key)
{
initial_password[j]=key;
lcd.print(key);
EEPROM.write(j,key);
j++;}}
lcd.print("Pass Changed");
delay(1000);}
 
lcd.clear();
lcd.print("Enter Password");
lcd.setCursor(0,1);
key_pressed=0;
}

void initialpassword(){
int j;
for(j=0;j<4;j++)
EEPROM.write(j,j+49);
for(j=0;j<4;j++)
initial_password[j]=EEPROM.read(j);}

I've decided it would be easier to buy an LCD compatible with LiquidCrystal library - as there are more tutorials for it online

please show a clear picture of your wiring ... is the adapter SOLDERED to the LCD?

if this is an I2C LCD (without PCF8574 Adapter) - please link the product and the datasheet.
Lot of these "multi interface LCDs" need a correct solder joint on the back of the LCD if used with I2C.
Please show a picture of the backside also.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.