The HD44780 is a text liquid-crystal display usually with 2x16 or 4x16 characters.
To use the HD44780, import the library hd44780
import hd44780OPEN()
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.
DB4 to DB7
DB4 = 0,
DB5 = 5, DB6 = 6, DB7 = 13E
19RS
26gpiochip
/dev/gpiochip0CLS()
Clears the display and sets cursor to 1,1.
PRINT(s)
Prints the string s.
s
Example:
print("Hello World")
Off()
Turns off the display.
On()
Turns on the display
Close()
Closes the HD44780.
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.
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 =-")