AVR-Based Serial Enabled LCDs Hookup Guide
Firmware Overview
The easiest way to control the display is to use the SparkFun SerLCD Arduino Library. But if you prefer, you can connect using any device that can produce serial UART, I2C, or SPI.
The most basic way to use these screens is to simply send characters to them. They will display on the screen as you send them, and then if you go beyond the last character of the screen, it will begin overwriting from the first spot.
You can choose to send characters over Serial UART, I2C, or SPI. The best way to learn about each communication protocol is to try out the "basic" example located in the GitHub repository.
In addition to basic operation, there are special commands you can send the screen for special operations (like "clear screen" or set cursor position) and configuration settings (like BAUD RATE).
Configuration & Command Set
The special pipe character '|' (also called the 'or' character) is used to tell the screen to enter "settings mode". You then follow this command with another special character (usually "ctrl+c", ctrl+d, etc.). A complete table of commands are shown below in ASCII, DEC and HEX. Any one of these representations is acceptable when sending a command character.
The HD44780 LCD controller is very common. The extended commands for this chip include but are not limited to those described in table. Please refer to the HD44780 datasheet for more information.
Note, this "cheat sheet" is also located at the top of each example code section for easy reference.
ASCII | DEC | HEX | Description |
---|---|---|---|
'|' | 124 | 0x7C | Enter Settings Mode. Note: When a second `|` ASCII character is sent to the display, the screen will escape the settings mode and display the same second vertical "pipe" as text. This feature is supported on v1.3+ of the SerLCD. |
ctrl+h | 8 | 0x08 | Software reset of the system |
ctrl+i | 9 | 0x09 | Enable/disable splash screen |
ctrl+j | 10 | 0x0A | Save currently displayed text as splash |
ctrl+k | 11 | 0x0B | Change baud to 2400bps |
ctrl+l | 12 | 0x0C | Change baud to 4800bps |
ctrl+m | 13 | 0x0D | Change baud to 9600bps |
ctrl+n | 14 | 0x0E | Change baud to 14400bps |
ctrl+o | 15 | 0x0F | Change baud to 19200bps |
ctrl+p | 16 | 0x10 | Change baud to 38400bps |
ctrl+q | 17 | 0x11 | Change baud to 57600bps |
ctrl+r | 18 | 0x12 | Change baud to 115200bps |
ctrl+s | 19 | 0x13 | Change baud to 230400bps |
ctrl+t | 20 | 0x14 | Change baud to 460800bps |
ctrl+u | 21 | 0x15 | Change baud to 921600bps |
ctrl+v | 22 | 0x16 | Change baud to 1000000bps |
ctrl+w | 23 | 0x17 | Change baud to 1200bps |
ctrl+x | 24 | 0x18 | Change the contrast. Follow Ctrl+x with number 0 to 255. 40 is default. |
ctrl+y | 25 | 0x19 | Change the TWI address. Follow Ctrl+y with number 0 to 255. 114 (0x72) is default. |
ctrl+z | 26 | 0x1A | Enable/disable ignore RX pin on startup (ignore emergency reset) |
ESC to '"' | 27-34 | 0x1B-0x22 | Record line of pixel data to a custom character. Up to eight characters can be recorded. Each character is made up of 7 lines of pixel data. Each line of pixel data must be proceeded by the character position to record within. 0x1B = character 0. 0x22 = character 7. For example, 0x1C 01 1C 03 1C 07 1C 0F 1C 1F 1C 3F 1C 7F will draw a triangle in character location 1. Saved to NVM. |
'#' to '*' | 35-42 | 0x23-0x2A | Display custom character 0 through 7. For example, 0x24 will display the character stored in location 1. 0x28 will display character stored in location 5. |
'+' | 43 | 0x2B | Set RGB Backlight. Follow this command with three bytes representing Red, Green, Blue, backlight values. Supported on v1.1+ of SerLCD. |
',' | 44 | 0x2C | Display current SerLCD firmware version. Supported on v1.1+ of SerLCD. If this command doesn't display anything version is v1.0. |
'-' | 45 | 0x2D | Clear display. Move cursor to home position. |
'.' | 46 | 0x2E | Enable system messages as settings change (ie, 'Contrast: 5'). Supported on v1.2+ of SerLCD. |
'/' | 47 | 0x2F | Disable the displaying of system messages. Supported on v1.2+ of SerLCD. |
'0' | 48 | 0x30 | Enable splash screen at power on. Similar to Ctrl+i command but definitive. Supported on v1.2+ of SerLCD. |
'1' | 49 | 0x31 | Disable splash screen at power on. Similar to Ctrl+i command but definitive. Supported on v1.2+ of SerLCD. |
n/a | 128-157 | 0x80-0x9D | Set the primary backlight brightness. 128 = Off, 157 = 100%. |
n/a | 158-187 | 0x9E-0xBB | Set the green backlight brightness. 158 = Off, 187 = 100%. |
n/a | 188-217 | 0xBC-0xD9 | Set the blue backlight brightness. 188 = Off, 217 = 100%. |
ctrl+c to ctrl+g | 3-7 | 0x03-0x07 | Depricated command: Send line width. |
Clear Screen and Set Cursor Position
Clear display and set cursor position are the two commands that are used frequently. To clear the screen, send the control character '|' followed by '-'. Clearing the screen resets the cursor position back to position 0 (i.e. the first character on the first line).
Here's how you could do it doing a Serial UART write on software serial:
language:cpp
OpenLCD.write('|'); //Send setting character
OpenLCD.write('-'); //Send clear display character
Note, most of the example sketches in the repo use these two commands during setup(), so you can try any of the examples out to see these commands in action.
To set the active cursor position, send the control character 254 followed by 128 + row + position. To give this a shot, check out the complete example sketch in the GitHub repo or copy and paste the following into your Arduino IDE:
language:cpp
/*
OpenLCD is an LCD with Serial/I2C/SPI interfaces.
By: Nathan Seidle
SparkFun Electronics
Date: April 19th, 2015
License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license).
OpenLCD gives the user multiple interfaces (serial, I2C, and SPI) to control an LCD. SerLCD was the original
serial LCD from SparkFun that ran on the PIC 16F88 with only a serial interface and limited feature set.
This is an updated serial LCD.
This example shows how to change the position of the cursor. This is very important as this is the
fastest way to update the screen, ie - rather than clearing the display and re-transmitting a handful of bytes
a cursor move allows us to re-paint only what we need to update.
We assume the module is currently at default 9600bps.
We use software serial because if OpenLCD is attached to an Arduino's hardware serial port during bootloading
it can cause problems for both devices.
Note: If OpenLCD gets into an unknown state or you otherwise can't communicate with it send 18 (0x12 or ctrl+r)
at 9600 baud while the splash screen is active and the unit will reset to 9600 baud.
Emergency reset: If you get OpenLCD stuck into an unknown baud rate, unknown I2C address, etc, there is a
safety mechanism built-in. Tie the RX pin to ground and power up OpenLCD. You should see the splash screen
then "System reset Power cycle me" and the backlight will begin to blink. Now power down OpenLCD and remove
the RX/GND jumper. OpenLCD is now reset to 9600bps with a I2C address of 0x72. Note: This feature can be
disabled if necessary. See *Ignore Emergency Reset* for more information.
To get this code to work, attached an OpenLCD to an Arduino Uno using the following pins:
RX (OpenLCD) to Pin 7 (Arduino)
VIN to 5V
GND to GND
Command cheat sheet:
ASCII / DEC / HEX
'|' / 124 / 0x7C - Put into setting mode
Ctrl+c / 3 / 0x03 - Change width to 20
Ctrl+d / 4 / 0x04 - Change width to 16
Ctrl+e / 5 / 0x05 - Change lines to 4
Ctrl+f / 6 / 0x06 - Change lines to 2
Ctrl+g / 7 / 0x07 - Change lines to 1
Ctrl+h / 8 / 0x08 - Software reset of the system
Ctrl+i / 9 / 0x09 - Enable/disable splash screen
Ctrl+j / 10 / 0x0A - Save currently displayed text as splash
Ctrl+k / 11 / 0x0B - Change baud to 2400bps
Ctrl+l / 12 / 0x0C - Change baud to 4800bps
Ctrl+m / 13 / 0x0D - Change baud to 9600bps
Ctrl+n / 14 / 0x0E - Change baud to 14400bps
Ctrl+o / 15 / 0x0F - Change baud to 19200bps
Ctrl+p / 16 / 0x10 - Change baud to 38400bps
Ctrl+q / 17 / 0x11 - Change baud to 57600bps
Ctrl+r / 18 / 0x12 - Change baud to 115200bps
Ctrl+s / 19 / 0x13 - Change baud to 230400bps
Ctrl+t / 20 / 0x14 - Change baud to 460800bps
Ctrl+u / 21 / 0x15 - Change baud to 921600bps
Ctrl+v / 22 / 0x16 - Change baud to 1000000bps
Ctrl+w / 23 / 0x17 - Change baud to 1200bps
Ctrl+x / 24 / 0x18 - Change the contrast. Follow Ctrl+x with number 0 to 255. 120 is default.
Ctrl+y / 25 / 0x19 - Change the TWI address. Follow Ctrl+x with number 0 to 255. 114 (0x72) is default.
Ctrl+z / 26 / 0x1A - Enable/disable ignore RX pin on startup (ignore emergency reset)
'-' / 45 / 0x2D - Clear display. Move cursor to home position.
/ 128-157 / 0x80-0x9D - Set the primary backlight brightness. 128 = Off, 157 = 100%.
/ 158-187 / 0x9E-0xBB - Set the green backlight brightness. 158 = Off, 187 = 100%.
/ 188-217 / 0xBC-0xD9 - Set the blue backlight brightness. 188 = Off, 217 = 100%.
For example, to change the baud rate to 115200 send 124 followed by 18.
*/
#include <SoftwareSerial.h>
SoftwareSerial OpenLCD(6, 7); //RX (not used), TX
int counter = 250;
void setup()
{
Serial.begin(9600); //Start serial communication at 9600 for debug statements
Serial.println("OpenLCD Example Code");
OpenLCD.begin(115200); //Begin communication with OpenLCD
//Send the reset command to the display - this forces the cursor to return to the beginning of the display
OpenLCD.write('|'); //Send setting character
OpenLCD.write('-'); //Send clear display character
OpenLCD.print("Hello World! Counter: "); //For 16x2 LCDs
//OpenLCD.print("Hello World! Counter: "); //For 20x4 LCDs
}
void loop()
{
OpenLCD.write(254); //Send command character
OpenLCD.write(128 + 64 + 9); //Change the position (128) of the cursor to 2nd row (64), position 9 (9)
OpenLCD.print(counter++); //Re-print the counter
//OpenLCD.print(" "); //When the counter wraps back to 0 it leaves artifacts on the display
delay(2); //Hang out for a bit if we are running at 115200bps
}
The two lines of code that are actually changing the cursor position are as follows:
language:cpp
OpenLCD.write(254); //Send command character
OpenLCD.write(128 + 64 + 9); //Change the position (128) of the cursor to 2nd row (64), position 9 (9)
The example sets the cursor to the second row, position 9. To set the cursor to the first row, position 0, the command would look like this:
language:cpp
OpenLCD.write(254); //Send command character
OpenLCD.write(128 + 0 + 0); //Change the position (128) of the cursor to 1st row (0), position 0 (0)
Use the following tables to see row commands and available positions:
16 Character Displays | |
---|---|
Line Number (command) | Viewable Cursor Positions |
1 (0) | 0-15 |
2 (64) | 0-15 |
20 Character Displays | |
---|---|
Line Number (command) | Viewable Cursor Positions |
1 (0) | 0-19 |
2 (64) | 0-19 |
3 (20) | 0-19 |
4 (84) | 0-19 |
Setting Up the LCD Size
You should never need to send any screen size configuration commands to setup these screens. During setup(), the firmware looks at a specific pin that is either left floating or tied high. From this it can determine which screen size it is populated on (16x2 or 20x4). However, the commands are still available for manually setting the width and lines.
ASCII | DEC | HEX | Description |
---|---|---|---|
'|' | 124 | 0x7C | Enter Settings Mode |
ctrl+c | 3 | 0x03 | Change width to 20 |
ctrl+d | 4 | 0x04 | Change width to 16 |
ctrl+e | 5 | 0x05 | Change lines to 4 |
ctrl+f | 6 | 0x06 | Change lines to 2 |
ctrl+g | 7 | 0x07 | Change lines to 1 |
Changing the Baud Rate
The screens ship out with a default baud rate setting to 9600 baud, but they can be set to a variety of baud rates. The 11.0592 MHz crystal provides greater clock accuracy and allows for baud rates up to 1MHz!
To change the baud rate, you will need to send two commands: First, send the "|" command to enter settings mode. Second, send the desired baud rate command. (For example, to set it to 57600, you'd send |, then Ctrl + q)
Here is a table will all of the available baud rate settings commands:
ASCII | DEC | HEX | Description |
---|---|---|---|
'|' | 124 | 0x7C | Enter Settings Mode |
ctrl+k | 11 | 0x0B | Change baud to 2400bps |
ctrl+l | 12 | 0x0C | Change baud to 4800bps |
ctrl+m | 13 | 0x0D | Change baud to 9600bps |
ctrl+n | 14 | 0x0E | Change baud to 14400bps |
ctrl+o | 15 | 0x0F | Change baud to 19200bps |
ctrl+p | 16 | 0x10 | Change baud to 38400bps |
ctrl+q | 17 | 0x11 | Change baud to 57600bps |
ctrl+r | 18 | 0x12 | Change baud to 115200bps |
ctrl+s | 19 | 0x13 | Change baud to 230400bps |
ctrl+t | 20 | 0x14 | Change baud to 460800bps |
ctrl+u | 21 | 0x15 | Change baud to 921600bps |
ctrl+v | 22 | 0x16 | Change baud to 1000000bps |
If your screen enters into an unknown state or you otherwise can't communicate with it, try sending a Ctrl + r (0x12) character at 9600 baud while the splash screen is active (during the first 500 ms of boot-up) and the unit will reset to 9600 baud.
Backlight Brightness
These screens provide you with control of the backlight to one of 30 different brightness levels on each of the colors (Red, Green and Blue). With this, you can mix colors together to get almost any custom color you'd like. This is also handy when power consumption of the unit must be minimized. By reducing the brightness, the overall backlight current consumption is reduced.
To change the backlight brightness, you will need to send two commands: First, send the "|" command to enter settings mode. Second, send a number that corresponds to the color and brightness you'd like to set. (For example, to set the Green backlight to 100%, you'd send |, then 187). For some good example code on how to adjust any and all of the colors, check out the example sketch here or copy and paste the code below into your Arduino IDE:
language:cpp
/*
OpenLCD is an LCD with serial/I2C/SPI interfaces.
By: Nathan Seidle
SparkFun Electronics
Date: April 19th, 2015
License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license).
OpenLCD gives the user multiple interfaces (serial, I2C, and SPI) to control an LCD. SerLCD was the original
serial LCD from SparkFun that ran on the PIC 16F88 with only a serial interface and limited feature set.
This is an updated serial LCD.
This example shows how to change the backlight brightness. We assume the module is currently at default 9600bps.
We use software serial because if OpenLCD is attached to an Arduino's hardware serial port during bootloading
it can cause problems for both devices.
Note: If OpenLCD gets into an unknown state or you otherwise can't communicate with it send 18 (0x12 or ctrl+r)
at 9600 baud while the splash screen is active and the unit will reset to 9600 baud.
Emergency reset: If you get OpenLCD stuck into an unknown baud rate, unknown I2C address, etc, there is a
safety mechanism built-in. Tie the RX pin to ground and power up OpenLCD. You should see the splash screen
then "System reset Power cycle me" and the backlight will begin to blink. Now power down OpenLCD and remove
the RX/GND jumper. OpenLCD is now reset to 9600bps with a I2C address of 0x72. Note: This feature can be
disabled if necessary. See *Ignore Emergency Reset* for more information.
To get this code to work, attached an OpenLCD to an Arduino Uno using the following pins:
RX (OpenLCD) to Pin 7 (Arduino)
VIN to 5V
GND to GND
Command cheat sheet:
ASCII / DEC / HEX
'|' / 124 / 0x7C - Put into setting mode
Ctrl+c / 3 / 0x03 - Change width to 20
Ctrl+d / 4 / 0x04 - Change width to 16
Ctrl+e / 5 / 0x05 - Change lines to 4
Ctrl+f / 6 / 0x06 - Change lines to 2
Ctrl+g / 7 / 0x07 - Change lines to 1
Ctrl+h / 8 / 0x08 - Software reset of the system
Ctrl+i / 9 / 0x09 - Enable/disable splash screen
Ctrl+j / 10 / 0x0A - Save currently displayed text as splash
Ctrl+k / 11 / 0x0B - Change baud to 2400bps
Ctrl+l / 12 / 0x0C - Change baud to 4800bps
Ctrl+m / 13 / 0x0D - Change baud to 9600bps
Ctrl+n / 14 / 0x0E - Change baud to 14400bps
Ctrl+o / 15 / 0x0F - Change baud to 19200bps
Ctrl+p / 16 / 0x10 - Change baud to 38400bps
Ctrl+q / 17 / 0x11 - Change baud to 57600bps
Ctrl+r / 18 / 0x12 - Change baud to 115200bps
Ctrl+s / 19 / 0x13 - Change baud to 230400bps
Ctrl+t / 20 / 0x14 - Change baud to 460800bps
Ctrl+u / 21 / 0x15 - Change baud to 921600bps
Ctrl+v / 22 / 0x16 - Change baud to 1000000bps
Ctrl+w / 23 / 0x17 - Change baud to 1200bps
Ctrl+x / 24 / 0x18 - Change the contrast. Follow Ctrl+x with number 0 to 255. 120 is default.
Ctrl+y / 25 / 0x19 - Change the TWI address. Follow Ctrl+x with number 0 to 255. 114 (0x72) is default.
Ctrl+z / 26 / 0x1A - Enable/disable ignore RX pin on startup (ignore emergency reset)
'-' / 45 / 0x2D - Clear display. Move cursor to home position.
/ 128-157 / 0x80-0x9D - Set the primary backlight brightness. 128 = Off, 157 = 100%.
/ 158-187 / 0x9E-0xBB - Set the green backlight brightness. 158 = Off, 187 = 100%.
/ 188-217 / 0xBC-0xD9 - Set the blue backlight brightness. 188 = Off, 217 = 100%.
For example, to change the baud rate to 115200 send 124 followed by 18.
*/
#include <SoftwareSerial.h>
SoftwareSerial OpenLCD(6, 7); //RX (not used), TX
byte counter = 0;
void setup()
{
Serial.begin(9600); //Begin local communication for debug statements
OpenLCD.begin(9600); //Begin communication with OpenLCD
OpenLCD.write('|'); //Put LCD into setting mode
OpenLCD.write(158 + 0); //Set green backlight amount to 0%
OpenLCD.write('|'); //Put LCD into setting mode
OpenLCD.write(188 + 0); //Set blue backlight amount to 0%
}
void loop()
{
//Control red backlight
Serial.println("Mono/Red backlight set to 0%");
OpenLCD.write('|'); //Put LCD into setting mode
OpenLCD.write(128); //Set white/red backlight amount to 0%
delay(2000);
//Control red backlight
Serial.println("Mono/Red backlight set to 51%");
OpenLCD.write('|'); //Put LCD into setting mode
OpenLCD.write(128 + 15); //Set white/red backlight amount to 51%
delay(2000);
//Control red backlight
Serial.println("Mono/Red backlight set to 100%");
OpenLCD.write('|'); //Put LCD into setting mode
OpenLCD.write(128 + 29); //Set white/red backlight amount to 100%
delay(2000);
//The following green and blue backlight control only apply if you have an RGB backlight enabled LCD
all_off(); // turn off all backlights - see function below
//Control green backlight
Serial.println("Green backlight set to 51%");
OpenLCD.write('|'); //Put LCD into setting mode
OpenLCD.write(158 + 15); //Set green backlight amount to 51%
delay(2000);
//Control green backlight
Serial.println("Green backlight set to 100%");
OpenLCD.write('|'); //Put LCD into setting mode
OpenLCD.write(158 + 29); //Set green backlight amount to 100%
delay(2000);
all_off(); // turn off all backlights - see function below
//Control blue backlight
Serial.println("Blue backlight set to 51%");
OpenLCD.write('|'); //Put LCD into setting mode
OpenLCD.write(188 + 15); //Set blue backlight amount to 51%
delay(2000);
//Control blue backlight
Serial.println("Blue backlight set to 100%");
OpenLCD.write('|'); //Put LCD into setting mode
OpenLCD.write(188 + 29); //Set blue backlight amount to 100%
delay(2000);
all_off(); // turn off all backlights - see function below
}
void all_off(void)
{
// Set all colors to 0
OpenLCD.write('|'); //Put LCD into setting mode
OpenLCD.write(128); //Set white/red backlight amount to 0%
OpenLCD.write('|'); //Put LCD into setting mode
OpenLCD.write(158 + 0); //Set green backlight amount to 0%
OpenLCD.write('|'); //Put LCD into setting mode
OpenLCD.write(188 + 0); //Set blue backlight amount to 0%
delay(2000);
}
And here is a table showing all of the available backlight settings and commands:
ASCII | DEC | HEX | Description |
---|---|---|---|
n/a | 128-157 | 0x80-0x9D | Set the primary backlight brightness. 128 = Off, 157 = 100%. |
n/a | 158-187 | 0x9E-0xBB | Set the green backlight brightness. 158 = Off, 187 = 100%. |
n/a | 188-217 | 0xBC-0xD9 | Set the blue backlight brightness. 188 = Off, 217 = 100%. |
Splash Screen
These LCD screens have a splash screen by default that reads "SparkFun OpenLCD Baud:9600". This splash screen verifies that the unit is powered, working correctly, and that the connection to the LCD is correct. The splash screen is displayed for 500 ms during boot-up and may be turned off if desired.
Setting Splash Screen
To make a custom splash screen, you need to send the characters you want to display (above we sent the characters "Custom Splash Looking good!") followed by |, then Ctrl + j). You will see a quick pop-up message display "Flash Recorded". Cycle power to test. You can also try out the example sketch located in the GitHub repo or copy and paste the code below into your Arduino IDE:
language:cpp
/*
OpenLCD is an LCD with serial/I2C/SPI interfaces.
By: Nathan Seidle, Pete Lewis
SparkFun Electronics
Date: 7/26/2018
License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license).
OpenLCD gives the user multiple interfaces (serial, I2C, and SPI) to control an LCD. SerLCD was the original
serial LCD from SparkFun that ran on the PIC 16F88 with only a serial interface and limited feature set.
This is an updated serial LCD.
This example shows how to change the Splash Screen contents. We assume the module is currently at default 9600bps.
We use software serial because if OpenLCD is attached to an Arduino's hardware serial port during bootloading
it can cause problems for both devices.
Note: If OpenLCD gets into an unknown state or you otherwise can't communicate with it send 18 (0x12 or ctrl+r)
at 9600 baud while the splash screen is active and the unit will reset to 9600 baud.
Emergency reset: If you get OpenLCD stuck into an unknown baud rate, unknown I2C address, etc, there is a
safety mechanism built-in. Tie the RX pin to ground and power up OpenLCD. You should see the splash screen
then "System reset Power cycle me" and the backlight will begin to blink. Now power down OpenLCD and remove
the RX/GND jumper. OpenLCD is now reset to 9600bps with a I2C address of 0x72. Note: This feature can be
disabled if necessary. See *Ignore Emergency Reset* for more information.
To get this code to work, attached an OpenLCD to an Arduino Uno using the following pins:
RX (OpenLCD) to Pin 7 (Arduino)
VIN to 5V
GND to GND
Command cheat sheet:
ASCII / DEC / HEX
'|' / 124 / 0x7C - Put into setting mode
Ctrl+c / 3 / 0x03 - Change width to 20
Ctrl+d / 4 / 0x04 - Change width to 16
Ctrl+e / 5 / 0x05 - Change lines to 4
Ctrl+f / 6 / 0x06 - Change lines to 2
Ctrl+g / 7 / 0x07 - Change lines to 1
Ctrl+h / 8 / 0x08 - Software reset of the system
Ctrl+i / 9 / 0x09 - Enable/disable splash screen
Ctrl+j / 10 / 0x0A - Save currently displayed text as splash
Ctrl+k / 11 / 0x0B - Change baud to 2400bps
Ctrl+l / 12 / 0x0C - Change baud to 4800bps
Ctrl+m / 13 / 0x0D - Change baud to 9600bps
Ctrl+n / 14 / 0x0E - Change baud to 14400bps
Ctrl+o / 15 / 0x0F - Change baud to 19200bps
Ctrl+p / 16 / 0x10 - Change baud to 38400bps
Ctrl+q / 17 / 0x11 - Change baud to 57600bps
Ctrl+r / 18 / 0x12 - Change baud to 115200bps
Ctrl+s / 19 / 0x13 - Change baud to 230400bps
Ctrl+t / 20 / 0x14 - Change baud to 460800bps
Ctrl+u / 21 / 0x15 - Change baud to 921600bps
Ctrl+v / 22 / 0x16 - Change baud to 1000000bps
Ctrl+w / 23 / 0x17 - Change baud to 1200bps
Ctrl+x / 24 / 0x18 - Change the contrast. Follow Ctrl+x with number 0 to 255. 120 is default.
Ctrl+y / 25 / 0x19 - Change the TWI address. Follow Ctrl+x with number 0 to 255. 114 (0x72) is default.
Ctrl+z / 26 / 0x1A - Enable/disable ignore RX pin on startup (ignore emergency reset)
'-' / 45 / 0x2D - Clear display. Move cursor to home position.
/ 128-157 / 0x80-0x9D - Set the primary backlight brightness. 128 = Off, 157 = 100%.
/ 158-187 / 0x9E-0xBB - Set the green backlight brightness. 158 = Off, 187 = 100%.
/ 188-217 / 0xBC-0xD9 - Set the blue backlight brightness. 188 = Off, 217 = 100%.
For example, to change the baud rate to 115200 send 124 followed by 18.
*/
#include <SoftwareSerial.h>
SoftwareSerial OpenLCD(6, 7); //RX (not used), TX
void setup()
{
Serial.begin(9600); //Begin local communication for debug statements
OpenLCD.begin(9600); //Begin communication with OpenLCD
delay(1000);
OpenLCD.write('|'); //Put LCD into setting mode
OpenLCD.write('-'); // clear screen
delay(1000);
OpenLCD.print("Custom Splash Looking good!"); // Send our new content to display - this will soon become our new splash screen.
OpenLCD.write('|'); //Put LCD into setting mode
OpenLCD.write(10); //Set current contents to splash screen memory (this is also a "ctrl-j", if you are doing it manually)
}
void loop()
{
// nothing here, just doing this example in setup()
}
Turning Splash Screen On/Off
To disable the splash screen, send |, then Ctrl + i. Every time this command is sent to the unit, the splash screen display option will toggle. If the splash screen is currently being displayed, sending |, then Ctrl + i will disable the splash screen during the next boot, and sending |, then Ctrl + i characters again will enable the splash screen.