The RGB-backlit LCD screen can display text in two rows of up to 16 characters each, backlit with an RGB (red-green-blue) LED capable of displaying 16.7M individual colours.
Hardware
Plug the LCD screen into any of the I2C ports on your Grove shield:
Software
Functions that interact with the LCD screen are prefixed with rgb_lcd
.
Initialization
No special initialization is required for interacting with the LCD screen.
Backlight control
The colour and intensity of the LCD screen’s backlight can be modified with the `rgb_lcd_colour`function.
- RGB control
-
Most computer displays (including this one) have a combination of coloured elements that can be combined to produce a variety of colours (e.g., red plus blue is purple). More specifically, the
lcd_rgb
function allows you to specify how much of the three additive primary colours (red, green and blue) should be present; each must be an integer in the range $[0,256)$.def rgb_lcd_colour(red, green, blue): """Change the LCD background colour by RGB value. Parameters: red (int): amount of red to display (0–255) green (int): amount of green to display (0–255) blue (int): amount of blue to display (0–255) """
You may find this RBG calculator or this colour picker helpful when working with RGB colours.
Text output
Text is displayed (or cleared!) on the LCD screen using the following functions.
def rgb_lcd_print(value, row, col):
"""Print a value to the LCD screen.
Parameters:
value: Any value, of any type.
row (int): Row on the LCD screen (range: [0, 1]) to start printing
col (int): Column on the LCD screen (range: [0, 15]) to start printing
"""
def rgb_lcd_clear():
"""Clear all text from the LCD screen
"""