diff --git a/adafruit_character_lcd/character_lcd.py b/adafruit_character_lcd/character_lcd.py index 56e408f..3468965 100755 --- a/adafruit_character_lcd/character_lcd.py +++ b/adafruit_character_lcd/character_lcd.py @@ -547,18 +547,18 @@ def _pulse_enable(self): class Character_LCD_Mono(Character_LCD): """Interfaces with monochromatic character LCDs. - :param ~digitalio.DigitalInOut rs: The reset data line - :param ~digitalio.DigitalInOut en: The enable data line - :param ~digitalio.DigitalInOut d4: The data line 4 - :param ~digitalio.DigitalInOut d5: The data line 5 - :param ~digitalio.DigitalInOut d6: The data line 6 - :param ~digitalio.DigitalInOut d7: The data line 7 - :param columns: The columns on the charLCD - :param lines: The lines on the charLCD - :param ~digitalio.DigitalInOut backlight_pin: The backlight pin - :param bool backlight_inverted: ``False`` if LCD is not inverted, i.e. backlight pin is - connected to common anode. ``True`` if LCD is inverted i.e. backlight pin is connected - to common cathode. + :param ~digitalio.DigitalInOut rs: The reset data line + :param ~digitalio.DigitalInOut en: The enable data line + :param ~digitalio.DigitalInOut d4: The data line 4 + :param ~digitalio.DigitalInOut d5: The data line 5 + :param ~digitalio.DigitalInOut d6: The data line 6 + :param ~digitalio.DigitalInOut d7: The data line 7 + :param columns: The columns on the charLCD + :param lines: The lines on the charLCD + :param ~digitalio.DigitalInOut backlight_pin: The backlight pin + :param bool backlight_inverted: ``False`` if LCD is not inverted, i.e. backlight pin is + connected to common anode. ``True`` if LCD is inverted i.e. backlight pin is connected + to common cathode. """ @@ -629,19 +629,19 @@ def backlight(self, enable): class Character_LCD_RGB(Character_LCD): """Interfaces with RGB character LCDs. - :param ~digitalio.DigitalInOut rs: The reset data line - :param ~digitalio.DigitalInOut en: The enable data line - :param ~digitalio.DigitalInOut db4: The data line 4 - :param ~digitalio.DigitalInOut db5: The data line 5 - :param ~digitalio.DigitalInOut db6: The data line 6 - :param ~digitalio.DigitalInOut db7: The data line 7 - :param columns: The columns on the charLCD - :param lines: The lines on the charLCD - :param ~pulseio.PWMOut, ~digitalio.DigitalInOut red: Red RGB Anode - :param ~pulseio.PWMOut, ~digitalio.DigitalInOut green: Green RGB Anode - :param ~pulseio.PWMOut, ~digitalio.DigitalInOut blue: Blue RGB Anode - :param ~digitalio.DigitalInOut read_write: The rw pin. Determines whether to read to or - write from the display. Not necessary if only writing to the display. Used on shield. + :param ~digitalio.DigitalInOut rs: The reset data line + :param ~digitalio.DigitalInOut en: The enable data line + :param ~digitalio.DigitalInOut db4: The data line 4 + :param ~digitalio.DigitalInOut db5: The data line 5 + :param ~digitalio.DigitalInOut db6: The data line 6 + :param ~digitalio.DigitalInOut db7: The data line 7 + :param columns: The columns on the charLCD + :param lines: The lines on the charLCD + :param ~pulseio.PWMOut, ~digitalio.DigitalInOut red: Red RGB Anode + :param ~pulseio.PWMOut, ~digitalio.DigitalInOut green: Green RGB Anode + :param ~pulseio.PWMOut, ~digitalio.DigitalInOut blue: Blue RGB Anode + :param ~digitalio.DigitalInOut read_write: The rw pin. Determines whether to read to or + write from the display. Not necessary if only writing to the display. Used on shield. """ diff --git a/examples/charlcd_rpi_rgb_simpletest.py b/examples/charlcd_rpi_rgb_simpletest.py index 6e6cc65..07948c9 100644 --- a/examples/charlcd_rpi_rgb_simpletest.py +++ b/examples/charlcd_rpi_rgb_simpletest.py @@ -2,6 +2,7 @@ import time import board import digitalio +import pulseio import adafruit_character_lcd.character_lcd as characterlcd # Modify this if you have a different sized character LCD @@ -15,11 +16,10 @@ lcd_d6 = digitalio.DigitalInOut(board.D22) # pin 13 lcd_d5 = digitalio.DigitalInOut(board.D24) # pin 12 lcd_d4 = digitalio.DigitalInOut(board.D25) # pin 11 -lcd_backlight = digitalio.DigitalInOut(board.D4) -red = digitalio.DigitalInOut(board.D21) -green = digitalio.DigitalInOut(board.D12) -blue = digitalio.DigitalInOut(board.D18) +red = pulseio.PWMOut(board.D21) +green = pulseio.PWMOut(board.D12) +blue = pulseio.PWMOut(board.D18) # Initialise the LCD class lcd = characterlcd.Character_LCD_RGB( @@ -34,25 +34,70 @@ red, green, blue, - lcd_backlight, ) -RED = [1, 0, 0] -GREEN = [0, 1, 0] -BLUE = [0, 0, 1] +RED = [100, 0, 0] +GREEN = [0, 100, 0] +BLUE = [0, 0, 100] while True: lcd.clear() - lcd.message = "CircuitPython\nRGB Test: RED" - lcd.color = RED + # Set LCD color to red + lcd.color = [100, 0, 0] time.sleep(1) - lcd.clear() - lcd.message = "CircuitPython\nRGB Test: GREEN" - lcd.color = GREEN + # Print two line message + lcd.message = "Hello\nCircuitPython" + + # Wait 5s + time.sleep(5) + + # Set LCD color to blue + lcd.color = [0, 100, 0] + time.sleep(1) + # Set LCD color to green + lcd.color = [0, 0, 100] time.sleep(1) + # Set LCD color to purple + lcd.color = [50, 0, 50] + time.sleep(1) + lcd.clear() + + # Print two line message right to left + lcd.text_direction = lcd.RIGHT_TO_LEFT + lcd.message = "Hello\nCircuitPython" + # Wait 5s + time.sleep(5) + + # Return text direction to left to right + lcd.text_direction = lcd.LEFT_TO_RIGHT + + # Display cursor + lcd.clear() + lcd.cursor = True + lcd.message = "Cursor! " + # Wait 5s + time.sleep(5) + + # Display blinking cursor + lcd.clear() + lcd.blink = True + lcd.message = "Blinky Cursor!" + # Wait 5s + time.sleep(5) + lcd.blink = False + lcd.clear() + + # Create message to scroll + scroll_msg = "<-- Scroll" + lcd.message = scroll_msg + # Scroll to the left + for i in range(len(scroll_msg)): + time.sleep(0.5) + lcd.move_left() + lcd.clear() + # Turn off LCD backlights and clear text + lcd.color = [0, 0, 0] lcd.clear() - lcd.message = "CircuitPython\nRGB Test: BLUE" - lcd.color = BLUE time.sleep(1)