lcd

class platypush.plugins.lcd.LcdPlugin(**kwargs)[source]

Abstract class for plugins to communicate with LCD displays.

Requires:

  • RPLCD (pip install RPLCD)

  • RPi.GPIO (pip install RPi.GPIO)

__init__(**kwargs)[source]
clear()[source]

Clear the LCD display.

close(clear: bool = False)[source]

Close the handler to the LCD display and release the GPIO resources.

Parameters

clear – Clear the display as well on close (default: False).

command(value: int)[source]

Send a raw command to the LCD.

Parameters

value – Command to be sent.

cr()[source]

Write a carriage return (\r) character to the LCD.

create_char(location: int, bitmap: List[int])[source]

Create a new character. The HD44780 supports up to 8 custom characters (location 0-7).

Parameters
  • location – The place in memory where the character is stored. Values need to be integers between 0 and 7.

  • bitmap – The bitmap containing the character. This should be a list of 8 numbers, each representing a 5 pixel row.

Example for the smiley character:

[
    0,   # 0b00000
    10,  # 0b01010
    10,  # 0b01010
    0,   # 0b00000
    17,  # 0b10001
    17,  # 0b10001
    14,  # 0b01110
    0    # 0b00000
]
crlf()[source]

Write a carriage return + line feed (\r\n) sequence to the LCD.

disable_backlight()[source]

Disable the display backlight.

disable_display()[source]

Turn off the display.

enable_backlight()[source]

Enable the display backlight.

enable_display()[source]

Turn on the display.

home()[source]

Set cursor to initial position and reset any shifting.

lf()[source]

Write a line feed (\n) character to the LCD.

set_cursor_pos(position: List[int])[source]

Change the position of the cursor on the display.

Parameters

position – New cursor position, as a list of two elements.

set_text_align(mode: str)[source]

Change the text align mode.

Parameters

mode – Supported values: left, right.

shift_display(amount: int)[source]

Set cursor to initial position and reset any shifting.

toggle_backlight()[source]

Toggle the display backlight on/off.

toggle_display()[source]

Toggle the display state.

write(value: int)[source]

Write a raw byte to the LCD.

Parameters

value – Byte to be sent.

write_string(value: str, position: Optional[List[int]] = None)[source]

Write a string to the display.

Parameters
  • value – String to be displayed.

  • position – String position on the display as a 2-int list.