SmallBASIC PiGPIO 2 logo
Last update: 24.10.2026

HD44780 - Text LCD

The HD44780 is a text liquid-crystal display usually with 2x16 or 4x16 characters.

Library

To use the HD44780, import the library hd44780

import hd44780

Function Reference

Open Device

OPEN()
OPEN(DB4, DB5, DB6, DB7, E, RS)
OPEN(DB4, DB5, DB6, DB7, E, RS, gpiochip)

Opens the HD44780 in 4bit mode using the Pins DB4 to DB7 for data, the enable Pin E and the RS pin RS.

Clear display

CLS()

Clears the display and sets cursor to 1,1.

PRINT(s)

Prints the string s.

Example:

print("Hello World")

Turn off display

Off()

Turns off the display.

Turn on display

On()

Turns on the display

Close device

Close()

Closes the HD44780.

Example

For running this example, you need a HD44780 compatible text display. SmallBASIC PiGPIO 2 uses GPIO for communication. Please be awarem that some text displays have an additional I2C module for communication. These display will not work with this library.

Please wire the display as shown in the following image.

Wiring hd44780
import hd44780 as LCD

const GPIO_DB4 = 0     ' Pin 27
const GPIO_DB5 = 5     ' Pin 29
const GPIO_DB6 = 6     ' Pin 31
const GPIO_DB7 = 13    ' Pin 33
const GPIO_E   = 19    ' Pin 35
const GPIO_RS  = 26    ' Pin 37

LCD.OPEN(GPIO_DB4, GPIO_DB5, GPIO_DB6, GPIO_DB7, GPIO_E, GPIO_RS)

LCD.CLS()

LCD.PRINT("  Hello  World")
LCD.LOCATE(1,2)
LCD.PRINT("-= SmallBASIC =-")

[Back to main page]