Lm016*2 lcd doesn't work

why the lcd just showing some bar graph ,nothing else.. for distance measurement project using ultrasonic sensor with arduino uno and lcdi2c?
i installed every library required for i2c and others, the code is:

#include<UltraDistSensor.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,20,4);

UltraDistSensor mysensor;
float reading;

void setup() {
lcd.init(); // initialize the lcd
lcd.backlight();
Serial.begin(9600);
mysensor.attach(12,13);//Trigger pin , Echo pin
}

void loop() {
reading=mysensor.distanceInCm();
lcd.setCursor(0,0);
lcd.print("Distance :- ");
lcd.print(reading);

delay(1000);

}

Generally this symptom traces back to:

  • Physical connections between display and Arduino not in order; i.e. bad contacts, wrong pins wired together etc.
  • Wrong I2C address selected; use an I2C scanner sketch to determine the correct address, or use a display library that auto-detects the address

Could you please provide me the auto library!
Contact is good as everything is in new condition.
Installed liquidcrystali2c also..

Do you have a schematic of your circuit and a detailed photo of how you've connected everything together?

You'll have to Google a bit; I always just use the old-fashioned ones and run an I2C scanner if necessary.

@saifparash, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the IDE 1.x category.

For the mentioned library, use sketch -> include library -> manage libraries in the IDE; wait for it to load. Type HD44780 in the search box and scroll through the list till you find the one by Bill Perry. Install it and study the examples.

Did you adjust the potentiometer and check the effect?

Note:
please read How to get the best out of this forum and apply what you've read about code tags to the code in you opening post.

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.

now its working... Thank you sooo much!!..all..

So - exactly what did you do to get it working?

  • loose connection detection
  • code changing
  • library installed mentioned above -hd..
  • pot adjustment

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