This Arduino library provides an easy-to-use interface for controlling an HD44780U (or similar) LCD display with a SN74HC595 (or similar) shift register. It can control the display with only four pins from the Arduino.
- Display text on an LCD screen.
- Scroll text left or right with customizable delays.
- Blink the display with a specified blink rate.
- Clear the display for a clean slate.
- See the interface section for all features.
- The pull down resistor connected to the LCDs D7-pin should be ca 10 kOhms.
- The 10 kOhms potentiometer connected to the LCDs V0-pin can be replaced by a ca 5 kOhms resistor.
Installation can be done either from the Arduino IDE or from the source code.
- Go to: Sketch > Include Library > Manage Libraries.
- Search after "ShiftLcd".
- Click install.
- Clone the repository to your projects directory.
cd <directoryOfProject>
git clone https://github.com/eb1992/ShiftLcd- Import the library via relative path instead:
#include "ShiftLcd/src/ShiftLcd.h"
- Include the
ShiftLcdlibrary in your Arduino sketch and create an instance of it:
#include <ShiftLcd.h>
int LCD_EN = 2;
int LCD_D7 = 3;
int SHIFT_SER = 4;
int SHIFT_SRCLK = 5;
ShiftLcd lcd(LCD_EN, LCD_D7, SHIFT_SER, SHIFT_SRCLK);- Initialize the LCD in the setup() function and write a message:
void setup() {
lcd.begin();
lcd.write("Hello, World!");
}- Use the library functions to control the LCD in the loop() function:
void loop() {
lcd.scrollLeft();
}Constructor. Initializes the LCD with specified pin numbers:
ShiftLcd(int LCD_EN, int LCD_D7, int SHIFT_SER, int SHIFT_SRCLK);Initialize the LCD:
void begin(); Turn on the LCD:
void on(); Turn off the LCD:
void off(); Shift the display text one step to the left:
void shiftLeft(); Shift the display text one step to the right:
void shiftRight(); Scroll text to the right:
void scrollRight(unsigned long delay); Scroll text to the right with the default time:
void scrollRight(); Scroll text to the left:
void scrollLeft(unsigned long delay); Scroll text to the left with the default time:
void scrollLeft(); Blink the display:
void blink(unsigned long delay); Blink the display with the default time:
void blink(); Clear the LCD display:
void clear(); Write a character array:
void write(char msg[]); Write two character arrays to the two rows of the display:
void write(char msg1[], char msg2[]); Write a character array and an integer to the two rows of the display:
void write(char msg[], int n); Write an integer:
void write(int n); Write a String:
void write(String msg); Write two Strings to the two rows of the display:
void write(String msg1, String msg2); Write a String and an integer to the two rows of the display:
void write(String msg, int n); 