I2C LCD Not working (white squares)

Hello! I have a I2C LCD and it is not working with my arduino UNO R3. I tried with different versions of the LCD_I2C library, but it is still not working. There are just white squares and they never disappear. Any help, please?

[code]
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,16,2); 

void setup() {
  lcd.init();
  lcd.backlight();
  lcd.setCursor(0, 1);
  lcd.print("Hello, world!");
}

void loop() {

}
[/code]

Sorry for my bad English

maybe the I2C address is incorrect. Try another common one 0x3F. Or try an I2C scanner to discover the actual address of your I2C module.

OK, here's the deal.

Go to the Library Manager, install Bill Perry's HD44780 library and run the examples in the libraries/hd44780/ioClass/hd44780_I2Cexp folder.

Most of the LiquidCrystal_I2C libraries are sadly obsolete.

Have you tried the contrast adjustment?

For an I2C LCD display to work, the I2C address and the I2C backpack to LCD pin mapping must be correct. If the library default settings for either or both are not correct the LCD will not work. You can try to figure out the right pin mapping and use an I2C scanner to find the address, but if you install and use the hd44780 library that is done automatically by the library.

To install the hd44780 library. The hd44780 library is the best available for I2C LCDs. The library is available in the Library Manager. Go to Library Manager (in the IDE menus, Sketch, Include Libraries, Manage Libraries) and in the Topics dropdown choose Display and in the Filter your search box enter hd44780. Select and install the hd44780 library by Bill Perry.

The class that you want to use is the hd44780_I2Cexp class. There are examples to show how to use the library. The nice thing about the hd44780 library is that it will autodetect the I2C address and the I2C backpack to LCD pin mapping.

In the examples, there is a diagnostic sketch that will help us to help you if you still have trouble with the display. Run the diagnostic sketch and post the results.

:roll_eyes:

Yes, I tried

I tried the diagnostic sketch but it gives this error:

'lcd' was not declared in this scope
Exception in thread "Multihomed mDNS.Timer" java.lang.Error: IP Helper Library GetIfTable function failed
	at java.net.NetworkInterface.getAll(Native Method)
	at java.net.NetworkInterface.getNetworkInterfaces(NetworkInterface.java:355)
	at javax.jmdns.impl.NetworkTopologyDiscoveryImpl.getInetAddresses(NetworkTopologyDiscoveryImpl.java:42)
	at javax.jmdns.impl.JmmDNSImpl$NetworkChecker.run(JmmDNSImpl.java:765)
	at java.util.TimerThread.mainLoop(Timer.java:555)
	at java.util.TimerThread.run(Timer.java:505)

The example works, but trying to put it in an existing project, it gives this error:

C:\Users\windows\Documents\Arduino\libraries\arduino_306579/hd44780ioClass/hd44780_I2Cexp.h:754:3: error: 'Wire' was not declared in this scope
   Wire.beginTransmission(address);

The scanner gives me the address that I put in the project

Does you sketch have this header
#include <Wire.h>

So you missed a line or two then when you copied it. :grin:

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