# I2c lcd only showing upper blocks nothing else

**URL:** <https://forum.arduino.cc/t/i2c-lcd-only-showing-upper-blocks-nothing-else/948753>\
**Category:** Displays\
**Created:** [January 19, 2022, 5:10am UTC](https://forum.arduino.cc/t/i2c-lcd-only-showing-upper-blocks-nothing-else/948753 "2022-01-19T05:10:05Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajaarin](https://avatars.discourse-cdn.com/v4/letter/r/58f4c7/32.png) [@rajaarin](https://forum.arduino.cc/u/rajaarin)\
**Post date:** [January 19, 2022, 5:10am UTC](https://forum.arduino.cc/t/i2c-lcd-only-showing-upper-blocks-nothing-else/948753/1 "2022-01-19T05:10:05Z")

</div>

I m making a distance measurement using arduino , ultrasonic sensor and i2c lcd.  
But after installing code also nothing visible on my screen only upper blocks is visible.  
THIS IS MY CODE

```cpp
#include <Wire.h> // Library for I2C communication
#include <LiquidCrystal_I2C.h> // Library for LCD
LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27, 16, 2); // Change to (0x27,16,2) for 16x2 LCD.my address is (0x3F)

int trigPin = A0;
int echoPin = A1;

long distance;
long distanceInch;
long duration;

void setup(){
 lcd.begin();
 lcd.backlight();
 pinMode(trigPin, OUTPUT);
 pinMode(echoPin, INPUT);

 lcd.setCursor(0,0);
 lcd.print(" WELCOME TO");
 lcd.setCursor(0,1);
 lcd.print(" MKINVENTIONS");
 delay(2000);
}

void loop() {
 ULTRASONIC();
 lcd.clear();
 lcd.setCursor(0,0);
 lcd.print("DISTANCE CM:");
 lcd.print(distance); 
 lcd.setCursor(0,1);
 lcd.print("DISTANCE INCH:");
 lcd.print(distanceInch); 

// lcd.setCursor(0,1);   
// lcd.print("DISTANCE MM:");
// lcd.print(distanceInch); 
}

void ULTRASONIC(){
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = duration*0.034/2;
  distanceInch = duration*0.0133/2;
} 

```

 ![1642568957192379127998923385817](https://europe1.discourse-cdn.com/arduino/original/4X/7/4/9/7491813f03d8baa2e436a072189a519e12b916bb.jpeg)

---

<div class="post-metadata">

**Author:** ![LarryD](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/larryd/32/215550_2.png) [@LarryD](https://forum.arduino.cc/u/LarryD)\
**Post date:** [January 19, 2022, 5:23am UTC](https://forum.arduino.cc/t/i2c-lcd-only-showing-upper-blocks-nothing-else/948753/2 "2022-01-19T05:23:02Z")

</div>

Turn the LCD contrast potentiometer down to the point where the blocks **just appear**.

---

<div class="post-metadata">

**Author:** ![rajaarin](https://avatars.discourse-cdn.com/v4/letter/r/58f4c7/32.png) [@rajaarin](https://forum.arduino.cc/u/rajaarin)\
**Post date:** [January 19, 2022, 6:04am UTC](https://forum.arduino.cc/t/i2c-lcd-only-showing-upper-blocks-nothing-else/948753/3 "2022-01-19T06:04:57Z")

</div>

I did that also then also its nt working only upper blocks r there .  
Even though I have tried a simple hello world cold also but that's also not showing

---

<div class="post-metadata">

**Author:** ![LarryD](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/larryd/32/215550_2.png) [@LarryD](https://forum.arduino.cc/u/LarryD)\
**Post date:** [January 19, 2022, 6:05am UTC](https://forum.arduino.cc/t/i2c-lcd-only-showing-upper-blocks-nothing-else/948753/4 "2022-01-19T06:05:48Z")

</div>

What address is your I2C LCD ?

---

<div class="post-metadata">

**Author:** ![rajaarin](https://avatars.discourse-cdn.com/v4/letter/r/58f4c7/32.png) [@rajaarin](https://forum.arduino.cc/u/rajaarin)\
**Post date:** [January 19, 2022, 6:21am UTC](https://forum.arduino.cc/t/i2c-lcd-only-showing-upper-blocks-nothing-else/948753/5 "2022-01-19T06:21:09Z")

</div>

0\*27

---

<div class="post-metadata">

**Author:** ![rajaarin](https://avatars.discourse-cdn.com/v4/letter/r/58f4c7/32.png) [@rajaarin](https://forum.arduino.cc/u/rajaarin)\
**Post date:** [January 19, 2022, 7:10am UTC](https://forum.arduino.cc/t/i2c-lcd-only-showing-upper-blocks-nothing-else/948753/6 "2022-01-19T07:10:41Z")

</div>

please help regarding this issue

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [January 19, 2022, 7:43am UTC](https://forum.arduino.cc/t/i2c-lcd-only-showing-upper-blocks-nothing-else/948753/7 "2022-01-19T07:43:38Z")

</div>

Other post/duplicate DELETED  
Please do NOT cross post / duplicate as it wastes peoples time and efforts to have more than one post for a single topic.

Continued cross posting could result in a time out from the forum.

Could you also take a few moments to [[url=https://forum.arduino.cc/index.php?topic=710766.0]](https://forum.arduino.cc/t/please-check-the-troubleshooting-guide-before-posting-here/52209/2)Learn How To Use The Forum[/url].

Other general [help and troubleshooting advice can be found here.](https://forum.arduino.cc/t/please-check-the-troubleshooting-guide-before-posting-here/52209/2)  
It will help you get the best out of the forum in the future.

---

<div class="post-metadata">

**Author:** ![markd833](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/markd833/32/1186928_2.png) [@markd833](https://forum.arduino.cc/u/markd833)\
**Post date:** [January 19, 2022, 7:52am UTC](https://forum.arduino.cc/t/i2c-lcd-only-showing-upper-blocks-nothing-else/948753/8 "2022-01-19T07:52:01Z")

</div>

Have you tried the LCD example(s) that came with the LCD library? Did they work?

---

<div class="post-metadata">

**Author:** ![Paul\_B](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paul_b/32/216376_2.png) [@Paul\_B](https://forum.arduino.cc/u/Paul_B)\
**Post date:** [January 19, 2022, 7:53am UTC](https://forum.arduino.cc/t/i2c-lcd-only-showing-upper-blocks-nothing-else/948753/9 "2022-01-19T07:53:00Z")

</div>

OK, not sure why Larry is barking up the wrong tree (and Mark just noted, sadly has **no** idea!).

You are seeing the "blocks" on the first line. That means your contrast control is set **more-or-less** correctly - good enough in any case.

What the "blocks" **mean** is that you are not "talking" to the display. Why? Well, using a completely _obsolete_ library, sad to say! 😟

OK, use the Library Manager in the IDE to install Bill Perry's "HD44780" library and then run from that library, the examples \> ioClass \> hd44780\_I2Cexp \> I2CexpDiag sketch to find the details for and test your display.

You can then work from one of the sketches in that directory to build what you need to. 😁

---

<div class="post-metadata">

**Author:** ![outbackhut](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/outbackhut/32/1099892_2.png) [@outbackhut](https://forum.arduino.cc/u/outbackhut)\
**Post date:** [June 23, 2022, 2:11am UTC](https://forum.arduino.cc/t/i2c-lcd-only-showing-upper-blocks-nothing-else/948753/10 "2022-06-23T02:11:34Z")

</div>

I wouldn't DREAM of using the HD44780 library. I have tried that one, but it just ISN'T as good OR easy to use as the one @rajaarin is currently using.  
@rajaarin, your screen will NEVER display anything with

```cpp
lcd.begin();

```

You MUST use

```cpp
lcd.init();

```

Change that and it should work.

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [June 23, 2022, 6:35am UTC](https://forum.arduino.cc/t/i2c-lcd-only-showing-upper-blocks-nothing-else/948753/11 "2022-06-23T06:35:49Z")

</div>

Whether you use lcd.init() or lcd.begin() depends entirely on which library you are using

As usual, the Devil is in the detail

---

<div class="post-metadata">

**Author:** ![outbackhut](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/outbackhut/32/1099892_2.png) [@outbackhut](https://forum.arduino.cc/u/outbackhut)\
**Post date:** [June 23, 2022, 8:50am UTC](https://forum.arduino.cc/t/i2c-lcd-only-showing-upper-blocks-nothing-else/948753/12 "2022-06-23T08:50:05Z")

</div>

@UKHeliBob  
True.  
The library in rajaarin's code uses `lcd.begin();` though, not `init();`.

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [June 23, 2022, 11:24am UTC](https://forum.arduino.cc/t/i2c-lcd-only-showing-upper-blocks-nothing-else/948753/13 "2022-06-23T11:24:45Z")

</div>

I must have missed where we established exactly which library was being used

---

<div class="post-metadata">

**Author:** ![outbackhut](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/outbackhut/32/1099892_2.png) [@outbackhut](https://forum.arduino.cc/u/outbackhut)\
**Post date:** [June 24, 2022, 12:27am UTC](https://forum.arduino.cc/t/i2c-lcd-only-showing-upper-blocks-nothing-else/948753/14 "2022-06-24T00:27:52Z")

</div>

![image](https://europe1.discourse-cdn.com/arduino/original/4X/5/8/d/58d857827086841456cd49e207c0d6703dc49ef6.png)

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [June 24, 2022, 6:45am UTC](https://forum.arduino.cc/t/i2c-lcd-only-showing-upper-blocks-nothing-else/948753/15 "2022-06-24T06:45:11Z")

</div>

If that was intended to show exactly which library is being used then it was a failure. All it shows is that the library is named LiquidCrystal\_I2C, of which there are several

---

<div class="post-metadata">

**Author:** ![outbackhut](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/outbackhut/32/1099892_2.png) [@outbackhut](https://forum.arduino.cc/u/outbackhut)\
**Post date:** [June 24, 2022, 7:14am UTC](https://forum.arduino.cc/t/i2c-lcd-only-showing-upper-blocks-nothing-else/948753/16 "2022-06-24T07:14:21Z")

</div>

Yeah, I guess. I just assumed it was the most used one.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [December 21, 2022, 7:15am UTC](https://forum.arduino.cc/t/i2c-lcd-only-showing-upper-blocks-nothing-else/948753/17 "2022-12-21T07:15:19Z")

</div>

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