Arduino Forum

Using Arduino => Introductory Tutorials => Topic started by: IoT_hobbyist on Feb 18, 2020, 10:00 am

Title: LCD I2C does not work! checklist
Post by: IoT_hobbyist on Feb 18, 2020, 10:00 am

Code: [Select]
// I2C address scanner program
#include <Wire.h>

void setup()
{
  Wire.begin();
  Serial.begin(9600);
  Serial.println("I2C Scanner");
}

void loop()
{
  byte error, address;
  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;
  for(address = 1; address < 127; address++ )
  {
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address < 16)
        Serial.print("0");

      Serial.print(address,HEX);
      Serial.println("  !");

      nDevices++;
    }
    else if (error==4)
    {
      Serial.print("Unknown error at address 0x");
      if (address < 16)
        Serial.print("0");

      Serial.println(address,HEX);
    }
  }

  if (nDevices == 0)
    Serial.println("No I2C devices found");
  else
    Serial.println("done");

  delay(5000); // wait 5 seconds for next scan
}

Learn more about LCD I2C in Arduino - LCD I2C  (https://arduinogetstarted.com/tutorials/arduino-lcd-i2c)tutorial.

Good luck!
Title: Re: LCD I2C does not work! checklist
Post by: DrAzzy on Feb 18, 2020, 10:49 am
Adjust the brightness of LCD by rotating potentiometer in the backside of LCD
Trick here: with only power, no data, it should display a row of black and white boxes. Adjust until these are the desired darkness/brightness.
Title: Re: LCD I2C does not work! checklist
Post by: lastchancename on Feb 18, 2020, 12:22 pm
Quote
Make sure that you wire LCD to Arduino correctly.
You may like to expand on this in your original post...
e.g. 4K7 resistors etc...
Beginners don't know what 'correctly' is.
Title: Re: LCD I2C does not work! checklist
Post by: groundFungus on Mar 13, 2020, 11:45 pm
For I2C character based LCDs with the hd4478 LCD driver the best current library is the hd44780 library by Bill Perry (https://github.com/duinoWitchery/hd44780).  The library will, automatically, detect the I2C address and the I2C backpack to LCD pin mapping.

The library is available for install through the library manager.
Title: Re: LCD I2C does not work! checklist
Post by: jackthomson42 on May 04, 2020, 07:37 am
I am trying to find the question in this thread ?
Title: Re: LCD I2C does not work! checklist
Post by: jubukraa on May 04, 2020, 07:39 am
I am trying to find the question in this thread ?
Read the forum heading...

(https://forum.arduino.cc/index.php?action=dlattach;topic=665383.0;attach=361465)