Python library to control DFRobot Gravity I2C LCD1602 with RGB Backlight Display or similar.
This library is based on official library DFRobot_RGBLCD1602 to control DFRobot Gravity I2C LCD1602. The offical library uses deprecated wiringpi, but this uses smbus and it's released as a standalone library.
Feel free to use and enjoy your LCD.
-
Connect your LCD to RPi via I2C pinouts, it accepts 5V.
-
Enable I2C on your RPi (using raspi-config)
-
Install (apt-get install i2c-tools) and use i2cdetect to check addresses.
Example:
$ i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- 2d -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- 3e -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --(the module uses 2 addresses)
Alternatively you can assume that the LCD has an address 0x3e and RGB's address depends on the hardware version: 0x2d (RGB V2.0), 0x60 (RGB V1.0), 0x6b (V1.1), 0x30 (V1.0).
pip install dfrgblcdpy
from dfrgblcdpy import DFRRGBLCDPY
# default addresses
lcd = DFRRGBLCDPY()
# set white backlight
lcd.set_color_white()
# first line
lcd.print_out("Hello!")
# second line
lcd.set_cursor(0, 1)
lcd.print_out("World!")See docs/dfrgblcdpy.html
Distributed under the MIT License. See LICENSE.txt for more information.