Libreria LiquidCrystal_I2C
Inizializzi il display e ne imposti l'indirizzo.
Libreria LiquidCrystal_I2C è una lezione Arduino & IoT Academy gratuita su CoddyKit. Questa è la lezione 2 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Arduino & IoT Academy, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Arduino & IoT Academy include 4 lezioni in totale.
Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.
What the Library Does
The LiquidCrystal_I2C library handles all the low-level I2C chatter for you. You just call simple commands to show text. 📚
Install It Once
Open the Library Manager in the Arduino IDE and search for LiquidCrystal_I2C. Click install and it is ready to use.
Include the Header
At the top of your sketch you add an include line so the compiler can find the library's code.
#include <LiquidCrystal_I2C.h>Create the Object
You make one lcd object that represents your display. Every command you give will go through this object.
LiquidCrystal_I2C lcd(0x27, 16, 2);The Address Argument
The first number is the I2C address. If your display stays blank, swap 0x27 for 0x3F, the other common value.
Columns and Rows
The next two numbers tell the library the size: 16 columns and 2 rows. This matches a standard 16x2 panel.
Initialize in setup
Inside setup you call lcd.init() once to wake the display and prepare it to receive text.
void setup() {
lcd.init();
}Turn On the Backlight
The screen starts dark until you call lcd.backlight(). This lights it up so the characters are readable.
lcd.backlight();Print Your First Word
Now lcd.print() sends text to the screen. Whatever you pass appears starting at the top-left corner. 🎉
lcd.print("Hello!");Clearing the Screen
Call lcd.clear() to wipe everything and move the cursor back to the start before writing fresh text.
lcd.clear();If It Stays Blank
Blank screen with backlight on usually means the wrong address. Run an I2C scanner sketch to find the real one.
Quick Check
Your sketch compiles but the LCD stays dark even with power. Which call did you likely forget?
Recap
You included LiquidCrystal_I2C, created an lcd object with its address and size, then called init and backlight. Your display is alive. ✅
Domande Frequenti
La lezione «Libreria LiquidCrystal_I2C» è gratuita?
Sì — il testo completo di «Libreria LiquidCrystal_I2C» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Arduino & IoT Academy, passa a CoddyKit PRO. Il corso Arduino & IoT Academy include 4 lezioni in totale.
Cosa imparerò in «Libreria LiquidCrystal_I2C»?
Inizializzi il display e ne imposti l'indirizzo. Eserciti Arduino & IoT Academy con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.
Ho bisogno di esperienza per iniziare Arduino & IoT Academy?
Non è richiesta alcuna esperienza precedente. Arduino & IoT Academy su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 2 di 4.
Quanto tempo richiede la lezione «Libreria LiquidCrystal_I2C»?
La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.
Posso scrivere ed eseguire codice in questa lezione Arduino & IoT Academy?
Sì. Ogni lezione Arduino & IoT Academy include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.
Tutte le lezioni di questo corso
- Collegare un LCD 16x2 (backpack I2C)
- Libreria LiquidCrystal_I2C
- Posizionare il cursore e stampare
- Dashboard dei sensori in tempo reale