1
0
Fork 0
mirror of https://github.com/kidoman/embd synced 2025-07-03 03:47:33 +02:00

controller: add a lib for the HD44780 character display controller

the hd44780 package supports HD44780 character display controllers
connected by either a 4-bit GPIO bus or an I2C bus

it also includes a high-level wrapper for easily printing messages
This commit is contained in:
Matthew Dale 2014-12-27 00:28:15 -08:00
parent 03b5f0ceb6
commit dac729e4fd
5 changed files with 1167 additions and 0 deletions

43
samples/hd44780.go Normal file
View file

@ -0,0 +1,43 @@
// +build ignore
package main
import (
"flag"
"time"
"github.com/kidoman/embd"
"github.com/kidoman/embd/controller/hd44780"
_ "github.com/kidoman/embd/host/all"
)
func main() {
flag.Parse()
if err := embd.InitI2C(); err != nil {
panic(err)
}
defer embd.CloseI2C()
bus := embd.NewI2CBus(1)
display, err := hd44780.NewI2CCharacterDisplay(
bus,
0x20,
hd44780.PCF8574PinMap,
20,
4,
hd44780.TwoLine,
hd44780.BlinkOn,
)
if err != nil {
panic(err)
}
defer display.Close()
display.Clear()
display.Message("Hello, world!\n@embd")
time.Sleep(10 * time.Second)
display.BacklightOff()
}