Oops a typo in the title, it should be any text not and text.
I am having a problem with my IC2 LCD 16 x 2 screen and all I get is a row of squares where the text should be.
After reading the GIThub section on how to install library files, I have now installed the extensible HD44780 library file from the Library Manager, and have included it into a new sketch.
The Serial Monitor was running prior to uploading, and now does not show anything. I then included the hd44780 library into an existing sketch, but again does not show anything other than reversed question marks when I use the serial monitor.
The SDA and SCL pins are on A4 and A5 respectifly, and the variable resistor or the pot on the back of the I2C board is turned fully clockwise.
It isn't clear what type of LCD device you have. You must use a library for the h/w that you have.
The example sketch you posted includes header files from 3 different LCD libraries
lcd_I2C
hd44780
LiqiudCrystal
But the sketch code is only using one of them.
The sketch code is using the LiquidCrystal library which is a library that drives an LCD using multiple Arduino pins not I2C nor an I2C through an i/o expander on a backpack.
That sketch tells the LiquidCrystal library that the LCD RS pin is connected to Arduino pin #1 which is the serial TX line which is likely why you see junk in the serial monitor as the LiquidCrystal library is wiggling Arduino pin #1 trying to control the LCD.
Assuming you have a an i2c backpack using a PCF8574 i/o expander,
all the information you needed to get up and running was in the other thread.
I would recommend going back and re-reading the posts in that thread starting at post #17 https://forum.arduino.cc/index.php?topic=552916.msg3786166#msg3786166
I would also recommend spending some time reading the information provided by the libraries and then looking at the examples they include to understand what h/w they are for and how they are used.
The board on the back of the LCD board has a PCF8574T chip on it
As mentioned I have read the GIThub section on how to install library files, I have now installed the extensible HD44780 library file from the Library Manager, and have included it into a new sketch.
Sorry, but starting from post #17 doesn't give me the information I need, from what I see.
After reading in another thread about the same problem, I have just ran the I2CexpDiag.ino program and it dispalys text on the LCD screen:
LCD: (0x3F)
00:04.39
This is the ouput to the Serial Monitor
Scanning i2c bus for devices..
i2c device found at address 0x3F
Total I2C devices found: 1
Scanning i2c bus for all lcd displays
LCD at address: 0x3F | config: P01245673H | R/W control: Yes
Total LCD devices found: 1
LCD Display Memory Test
Display: 0
Walking 1s data test: PASSED
Address line test: PASSED
Each working display should have its backlight on
and be displaying its #, address, and config information
If all pixels are on, or no pixels are showing, but backlight is on, try adjusting contrast pot
If backlight is off, wait for next test
Blinking backlight test: to verify BL level autodetection
If backlight is mostly off but
you briefly see "BL Off" on display with backlight on,
then the library autodetected incorrect BL level
and the library cannot autoconfigure the device
avvy66:
I have just ran the I2CexpDiag.ino program and it dispalys text on the LCD ...
Which means the hd44780 library was able to fully test your LCD device and you saw the expected results on the display, so everything is working as expected.
BTW,
Running the included I2CexpDiag sketch was recommended in your other thread.
It is also recommended on the hd44780_I2Cexp wiki:
I don't think it worked then as I didn't install the libraries the correct way, but it does now.
I have read through the github link on the hd44780 now, so is there anything else I should do to get the LCD to display text.
It seems to me, from what little I know, that the LCD works as it should but the code is falling down at some point with the correct instructions.
I have googled this problem and it looks like it's a common problem which was cured by various means.
One of those means was to insert lcd.backlight in the setup of a sketch, and in other places in the loop section. Althought it worked for 1 person it didn't work for me.
In your other thread I provided working and tested code in reply #30.
Here is your code using the hd44780 library. I commented the DHT stuff for testing as I don't have that library and it is not relevant to get the LCD to work. Uncomment the DHT parts once the LCD works. Tested with my Uno and 2x16 I2C LCD.
Yes I now realise the code was changed by yourself to get it woring. I actually thought it was just a copy of what I posted. Doh!
The new code does look a lot tidier.
Thanks very much for your work and understanding , as the I2C LCD display does now show text.
Just a quick question: should I use the HD44780 library instead of the LiquidCrystal library in future similar projects.
avvy66:
I have read through the github link on the hd44780 now, so is there anything else I should do to get the LCD to display text.
The LCD was displaying text. You saw text on the display when the diagnostics tool ran.
Likewise you would have seen text on the LCD when you ran any of the included hd44780_I2Cexp examples.
In order to see text on the display you have to use a library for the LCD h/w that you have.
It seems to me, from what little I know, that the LCD works as it should but the code is falling down at some point with the correct instructions.
The hd4780 hd44780_I2Cexp class code was working exactly as it should and was displaying text.
What I keep seeing is a lack of reading and paying close attention to what is written and information provided.
For example, initially you were trying to control the LCD with library (LiquidCrystal) which uses Arduino pins rather than I2C.
You then included header files from two other libraries, but were still using the LiquidCrystal library to try to control the LCD device.
These errors indicate you were not reading the information for any of the 3 libraries to understand which h/w they were for and how to use them.
The hd44780 library comes with many examples that demonstrate how to use the library and some of its features.
There are examples for each i/o class and you simply look at the examples that are for the h/w that you have.
avvy66:
Just a quick question: should I use the HD44780 library instead of the LiquidCrystal library in future similar projects.
You must use the proper library for the h/w that you have.
Different libraries are for different LCD h/w.
They all include some level of information explaining which LCD h/w that they work with - but you must take the time to read the information.
Just read the documentation for the library and use the library that is for the h/w that you have.
Then use the library the way the library documentation and/or examples say to use it.
bperrybap:
What I keep seeing is a lack of reading and paying close attention to what is written and information provided.
For example, initially you were trying to control the LCD with library (LiquidCrystal) which uses Arduino pins rather than I2C.
You then included header files from two other libraries, but were still using the LiquidCrystal library to try to control the LCD device.
These errors indicate you were not reading the information for any of the 3 libraries to understand which h/w they were for and how to use them
--- bill
Being a 68 year old pensioner should tell you something, as I do not do it deliberately.
Thank you for hilighting that fact.