Firmware library for Adafruit's USB + Serial Backpack Kit with 16x2 RGB LCD.
This library only supports the TTL serial connection.
This library has been tested with the Particle Photon and Adafruit Huzzah ESP8266. Other Arduino boards should work too (but may require minor changes to the library).
Wire the board as follows:
- Red wire to +5V (VIN, VBUS, etc.)
- Black wire to ground (GND)
- White wire to TX
Even though the Particle Photon and Adafruit Huzzah operate at 3.3v logic, powering it via USB does provide ~5V output on one of the pins, which is sufficient for powering the LCD backpack. Furthermore, because data is only being transmitted from the device (and not received from it to the board), we don't have to worry about level shifting.
This documentation is adapted from https://learn.adafruit.com/usb-plus-serial-backpack/command-reference.
SerialRGBLCD lcd;
void setup()
{
lcd.begin(9600);
}
Initializes the serial connection at the specified bitrate. baud
can be any of the following: 2400
, 4800
, 9600
(default), 19200
, 28800
, or 57600
.
Turns the display on.
Turns the display off.
Sets the brightness between 0
(dimmest) and 255
(brightest). You can change whether this setting should persist to EEPROM.
Sets the contrast between 0
and 255
. You can change whether this setting should persist to EEPROM.
Values between 180
and 220
tend to work best.
When enabled (true
), if text is received and there's no more room to display it, the screen will automatically "scroll down" - the second line will "move up" to become the first line and the additional text will display below it.
When disabled (false
), any additional text will wrap around to the start of the display.
Clears the screen.
Changes the default splash text which appears when the LCD is first powered on.
Sets the cursor to the given position. Note that column and row numbering start at 1
, not 0
.
Sets the cursor location to 1, 1
(top-left corner).
Moves the cursor backwards by one position, wrapping around to the last position if needed.
Moves the cursor forward by one position, wrapping around to the first position if needed.
Turns the underline cursor off (false
) or on (true
).
Turns the block cursor off (false
) or on (true
).
Sets the color of the backlight. Each color component (red, green, and blue) are represented by a single byte between 0
and 255
. This value will be persisted to EEPROM.
There are four banks available for storing custom characters, and each supports up to 8 different characters.
Saves the custom character pixels given by data
into the given bank's slot.
Loads the given bank
of custom characters into memory.
This class extends from Arduino's Print
class, allowing you to display different types of variables by using the print()
method.
If you'd like to write a raw byte, you may directly use the underlying write(uint8_t)
method instead.