Skip to content

Commit 7fdcaa3

Browse files
committed
1 parent 5b85a4a commit 7fdcaa3

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

20-lcd_1602_16x2/20-lcd_1602_16x2.ino

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// 16x2 LCD (without I2C mdule) in 4-Wire Mode
2+
3+
// https://www.instructables.com/Arduino-Interfacing-With-LCD-Without-Potentiometer
4+
// https://circuitdigest.com/article/16x2-lcd-display-module-pinout-datasheet
5+
6+
#include <LiquidCrystal.h> // https://www.arduino.cc/reference/en/libraries/liquidcrystal
7+
8+
constexpr uint8_t V0 = 6; // Contrast // LCD voltage bias signal
9+
constexpr uint8_t RS = 12; // Toggles between Data/Command Register
10+
constexpr uint8_t E = 11; // Enable // Must be held high to perform Read/Write Operation
11+
constexpr uint8_t D4 = 5; // Data/Command Pin // Pins used to send Command or Data to the LCD // In 4-Wire Mode only 4 pins are connected to MCU
12+
constexpr uint8_t D5 = 4; // Data/Command Pin // Pins used to send Command or Data to the LCD // In 4-Wire Mode only 4 pins are connected to MCU
13+
constexpr uint8_t D6 = 3; // Data/Command Pin // Pins used to send Command or Data to the LCD // In 4-Wire Mode only 4 pins are connected to MCU
14+
constexpr uint8_t D7 = 2; // Data/Command Pin // Pins used to send Command or Data to the LCD // In 4-Wire Mode only 4 pins are connected to MCU
15+
constexpr uint8_t A = 10; // Backlight PWM pin
16+
17+
LiquidCrystal lcd(RS, E, D4, D5, D6, D7); // 4-Wire Mode
18+
19+
void setup() {
20+
constexpr uint8_t contrast = 60;
21+
constexpr uint8_t brightness = 100; // of the backlight
22+
23+
analogWrite(V0, contrast);
24+
analogWrite(A, brightness);
25+
26+
lcd.begin(16, 2); // `columns`, `rows`
27+
28+
lcd.setCursor(0, 0); lcd.print(" Daniil ");
29+
lcd.setCursor(0, 1); lcd.print(" Semenenko ");
30+
// LCD display scroll borders: [ {_________...}3]
31+
}
32+
33+
34+
void loop() {
35+
constexpr uint64_t interval = 800; // miliseconds
36+
constexpr int shift = 3; // columns
37+
38+
for (int i = 0; i < shift; i++) {
39+
lcd.scrollDisplayRight();
40+
delay(interval);
41+
}
42+
delay(interval);
43+
44+
for (int i = 0; i < shift; i++) {
45+
lcd.scrollDisplayLeft();
46+
delay(interval);
47+
}
48+
delay(interval);
49+
}

20-lcd_1602_16x2/lcd_1602.webp

6.07 MB
Binary file not shown.

20-lcd_1602_16x2/readme.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
![](lcd_1602.webp)
2+
3+
https://forum.arduino.cc/t/how-to-control-lcd-backlight/684719/11

0 commit comments

Comments
 (0)