LCD1602 on pins 7 to 12, on an Arduino Uno
A 16x2 LCD with RS on pin 7, E on 8 and D4 to D7 on pins 9 to 12: a greeting on the top line and the seconds since reset under it. The whole build, an Arduino Uno and 1 more part, runs here in your browser on the firmware below; open it in the editor to change the wiring or the code and run it again.
Teaching? Assign it to your class in one click.
Beginner Runs in your browser. Free, and no account needed.
The code
The firmware exactly as the editor opens it. Change a line there and press Run: it compiles in the browser.
// A 16x2 LCD on pins 7 to 12: a greeting, and a seconds counter under it.
//
// LCD RS -> pin 7 LCD E -> pin 8
// LCD D4 -> pin 9 LCD D5 -> pin 10 LCD D6 -> pin 11 LCD D7 -> pin 12
// LCD RW, VSS, K -> GND LCD VDD, A -> 5V
// LCD V0 (contrast) -> GND here; on the bench, the middle leg of a 10k pot
//
// The display has its own controller chip. LiquidCrystal sends it commands
// and characters four bits at a time over D4 to D7, and E tells it when the
// four bits are ready. The order of the numbers in the constructor is RS, E,
// D4, D5, D6, D7.
//
// lcd.setCursor(column, row) counts from zero: (0, 1) is the start of the
// second line.
#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
void setup() {
lcd.begin(16, 2);
lcd.print("Hello, World!");
Serial.begin(9600);
Serial.println("Mokxi Uno: LCD1602 on pins 7 to 12");
}
void loop() {
lcd.setCursor(0, 1);
lcd.print(millis() / 1000);
lcd.print(" s");
delay(200);
}
Parts list
3 parts, plus the jumper wires. Every one is in the editor's parts bin.
How it is wired
8 connections, pin by pin, read from the circuit itself. Each line is one set of pins joined together, by a jumper wire or a breadboard strip.
- Arduino Uno R3 pin 12; Character LCD, 16x2 pin D7
- Arduino Uno R3 pin 11; Character LCD, 16x2 pin D6
- Arduino Uno R3 pin 10; Character LCD, 16x2 pin D5
- Arduino Uno R3 pin 9; Character LCD, 16x2 pin D4
- Arduino Uno R3 pin 8; Character LCD, 16x2 pin E
- Arduino Uno R3 pin 7; Character LCD, 16x2 pin RS
- Arduino Uno R3 pin 5V; Character LCD, 16x2 pin VDD; Character LCD, 16x2 pin A
- Ground: Arduino Uno R3 pin GND; Character LCD, 16x2 pin VSS; Character LCD, 16x2 pin V0; Character LCD, 16x2 pin RW; Character LCD, 16x2 pin K
Change it and keep it
Open it in the editor, change the circuit or the code, and keep your version in a free account.