Preview build — page text is a draft awaiting human review. Code badges come from real compiles. The flasher is real but not yet hardware-tested; the Playground is still a preview.
Display · 16×2 I2C LCD

Fix I2C LCD printing only the first character

lcd.print("Hello") shows just “H”: an old LiquidCrystal_I2C copy whose write() returns 0. Install the current library (1.1.2) or change return 0 to return 1.

Arduino UnoArduino NanoESP32ESP8266Updated 3 Nov 2026

Community draft — report a mistake

What you see

OutputOutput
Sketch uses 4312 bytes (13%) of program storage space. Maximum is 32256 bytes.
Global variables use 395 bytes (19%) of dynamic memory, leaving 1653 bytes for local variables. Maximum is 2048 bytes.

LCD row 0:  H
LCD row 1:  T
(expected "Hello, world!" and "Temp: 31.2 C")

If the LCD lights up, initialises and shows exactly one character per print(), the hardware is fine. The library is telling Arduino’s print code that nothing was written, so printing stops after the first letter.

In the current library the function reads:

inline size_t LiquidCrystal_I2C::write(uint8_t value) {
  send(value, Rs);
  return 1;     // old copies had "return 0;" here
}

Quick fix — try in order

  1. 1

    Install the current LiquidCrystal I2C

    Library Manager → LiquidCrystal I2C by Frank de Brabander → 1.1.2. Delete any older copy in Documents/Arduino/libraries (often from a ZIP in a tutorial).

  2. 2

    Or patch the old copy

    Open LiquidCrystal_I2C.cpp and find inline size_t LiquidCrystal_I2C::write(uint8_t value). Change return 0; to return 1;.

  3. 3

    Check which copy is used

    Turn on verbose compile output; the “Using library LiquidCrystal_I2C … in folder:” line shows the path. Duplicates trigger Multiple libraries were found.

  4. 4

    Variant: only the first character of each print()

    Same bug — every print() call outputs one character, so a sketch with many short prints looks half-working.

Why it happens

Why does write() returning 0 matter?

Arduino’s Print::print() sends a string one character at a time and stops as soon as write() reports 0 bytes written. Old LCD library versions returned 0 after successfully sending the first character.

It worked with an old IDE

Before Arduino 1.0, print() ignored the return value. Library copies written for pre-1.0 IDEs carry this bug.

Display shows blocks or nothing at all

Different problem: contrast or address — see LCD shows blocks or blank.

Board-specific notes

Arduino Uno: Tested sketch with the 1.1.2 library: 16×2 I2C LCD with Uno.

ESP32: The current library compiles with an architecture warning on ESP32 — harmless, see claims to run on avr.

↑↓ to move · Enter to open