03 / Templates · intermediate
LCD 2004 FOUR ROWS
Open in PlaygroundWrites a static message to all four rows of a 20×4 LCD using the LiquidCrystal library in 4-bit mode. Identical wiring to the 1602 — only lcd.begin() changes.
intermediateLCDdisplayLiquidCrystaltext2004
sketch.inoArduino C++
15 lines
// LCD 2004 — fills all four rows
#include <LiquidCrystal.h>
// RS, E, D4, D5, D6, D7
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
lcd.begin(20, 4);
lcd.setCursor(0, 0); lcd.print("Row 0: Hello!");
lcd.setCursor(0, 1); lcd.print("Row 1: Arduino");
lcd.setCursor(0, 2); lcd.print("Row 2: LCD 2004");
lcd.setCursor(0, 3); lcd.print("Row 3: 20 x 4");
}
void loop() {}
- wokwi-arduino-uno01
- wokwi-lcd200402
| Component Pin | Arduino Pin |
|---|---|
| RS | Pin 12 |
| RW | GND |
| E (Enable) | Pin 11 |
| D4 | Pin 5 |
| D5 | Pin 4 |
| D6 | Pin 3 |
| D7 | Pin 2 |
| VSS, V0, RW, K | GND |
| VDD, A (via 220 Ω) | 5V |