IC2 scanner stuck in scanning

Hello everyone
I am new with Arduino

I am having difficulties with my LCD 16x2 IC2 display

it is not showing anything
then, I searched and found out that i need the address for the IC2 of the screen or i think so

anyway, can somebody help me in trying to figure out why when i am running the following program, it stays at scanning. thank you

Please post your code with code tags. The code tags make the code look

like this

when posting source code files. It makes it easier to read, and can be copied with a single mouse click. Also, if you don't do it, some of the character sequences in the code can be misinterpred by the forum code as italics or funny emoticons. The "Code: [Select]" feature allows someone to select the entire sketch so it can be easily copied and pasted into the IDE for testing.

Unless the sketch is too large, it's better if you post your code, rather than attach it. When it's attached, we have to download it, create a folder then open your code in our IDE. And afterwards, the folder remains unless we navigate to the "Temp" folder and manually remove it. It's much easier to just view the code in your post.


I am having difficulties with my LCD 16x2 IC2 display

See this page for a lot of How-To and example code for these displays.

i2c scanner programs can scan for several reasons.
Some of the more common ones are

  • it is scanning illegal addresses
    old versions of scanner (you never said which one you were using) scanned all addresses including the reserved address. On some Arduino boards (you never said which one you were using), scanning the reserved address can hang the sketch.
  • Missing external pullup resistors.
    Some i2c backpacks have the required pullups on them and some don't.
    Some Arduino boards have them on the board but most don't.
    Some processors on the Arduino board have built in pullups that can be used which generally work, but not always. The built in pullups inside the AVR processors are way too weak and can cause issues.
  • wired incorrectly.
    In reality this is usually due to "missing" pullups. But the missing pullups are because of the incorrect wiring, which means that the processor is not seeing proper signal levels on the SDA and SCL pins.

Boards that have no internal pullups will often hang if no external pullups are present.
This includes boards like the DUE, pic32 based boards, and ESP8266 based boards.

My recommendation would be to use my hd44780 library.
It can offer a simpler "plug and play" solution and includes a diagnostic sketch to detect i2c signal issues.
It is available in the IDE library manager so it can quickly and easily be installed from the IDE gui using the library manager.
With other i2c LCD libraries you must specify the i2c address. Most libraries are also hard coded to work with backpacks that use a specific pin mapping between the PCF8574 and the hd44780 LCD display and if your backpack doesn't use that pin mapping, it won't work.
A few libraries, like fm's NewLiquidCrystal library allow the sketch to configure the PCF8574 pin mappings and backlight control.
If the pin mappings are not specified correctly, it will not work.
The hd44780 library can auto detect everything, the i2c address, the pin mappings, and the backlight control.
You can read more about it here: GitHub - duinoWitchery/hd44780: Extensible hd44780 LCD library
And there is additional information in the wiki:Home · duinoWitchery/hd44780 Wiki · GitHub

The hd44780 github page contains information about the library including installation instructions.
Use the IDE library manager to install it as it is easier and faster than trying to do it manually or using the zip install.
Also, by using the IDE library manager it ensures that the library is installed properly not to mention that you will also get the latest tested version of the library.

The library package includes support for several different h/w i/o interfaces used to communicate with the LCD module.

Each i/o interface has its own i/o class and its own set of examples.
The i/o class you will want to use for that backpack which contains an i2c i/o expander chip is hd44780_I2Cexp
That i/o class includes a diagnostic sketch (I2CexpDiag) which will test the i2c signals and internal RAM of the LCD module to verify that the the library is properly communicating with the LCD module.
It is useful to first run this sketch to verify that the library is properly talking to your backpack and LCD module.
Read the instructions in the sketch for how to run it and what to expect on the serial monitor.

After running the diagnostic sketch, you can run and look at other sketches for the hd44780_I2Cexp i/o class like the HelloWorld sketch to see what header files need to be included and how to declare the lcd object.

The hd44780 library contains additional capabilities not available in other libraries like

  • return status to tell if API functions are not working correctly (usually do to i2c communication issues)
  • ability to enable automatic line wrapping
  • ability to read the display RAM or LCD status
  • faster than other libraries as Arduino can run in parallel with LCD commands/instructions

I would highly recommend first running the diagnostic skech I2CexpDiag to verify that everything is working, then you can run and look at the other examples included in the hd44780_I2Cexp i/o class (like HelloWorld) to see what header files need to be included and how to declare the lcd object.

--- bill