https://github.com/pimvanhespen/go-pi-lcd1602
Go library for communicating to lcd1602 from Raspberry Pi
https://github.com/pimvanhespen/go-pi-lcd1602
animation go gpio lcd lcd1602 lcd16x2 raspberry-pi-3 virtual-lcd
Last synced: 11 months ago
JSON representation
Go library for communicating to lcd1602 from Raspberry Pi
- Host: GitHub
- URL: https://github.com/pimvanhespen/go-pi-lcd1602
- Owner: pimvanhespen
- License: mit
- Created: 2018-10-31T15:55:50.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-31T14:11:59.000Z (over 7 years ago)
- Last Synced: 2025-06-23T15:51:14.454Z (12 months ago)
- Topics: animation, go, gpio, lcd, lcd1602, lcd16x2, raspberry-pi-3, virtual-lcd
- Language: Go
- Homepage:
- Size: 1.34 MB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Golang LCD1602 (LCD16x2) for RaspberryPi
[](https://godoc.org/github.com/pimvanhespen/go-pi-lcd1602)
[](https://goreportcard.com/report/github.com/pimvanhespen/go-pi-lcd1602)
[](https://github.com/pimvanhespen/go-pi-lcd1602/blob/master/LICENSE.md)
Use LCD screens in your Go RPi applications!
## Fast
The timing in this library is optimized to run as smoot as possible.
(It takes **~40 microseconds** to write one character to the LCD, opposed to many online examples taking **5-10 milliseconds**).
## Animated
You can use **Animations** (see animations, and examples/animations.go) to slide text into and out of the LCD.
You can also create your own animations by implementing the `Animation` interface.
## Virtual LCD
I wrote a virtual representation of an LCD screen. You can use it for debugging on de command line, or when your LCD is broken...
## Usage
### Import
```go
import "github.com/pimvanhespen/go-pi-lcd1602"
```
Also checkout the [examples](https://github.com/pimvanhespen/go-pi-lcd1602/tree/master/examples)!
### Short example
```go
// write code to your LCD in 5 simple steps!
// 1. Define the LCD config (which pins are used)
lcdi := lcd1602.New(
10, //rs
9, //enable
[]int{6, 13, 19, 26}, //datapins
16, //lineSize
)
// 2. Create a synchronized LCD (for writing both lines easily)
lcd := synchronized.NewSynchronizedLCD(lcdi)
// 3. Init the LCD
lcd.Initialize()
// 4. Write text to the LCD
lcd.WriteLines("Go Rpi LCD 1602", "git/PimvanHespen")
// 5. Close the lcd (i.e. clean up GPIO memory)
lcd.Close()
}
```
## Todo
- lanning on decoupling the LCD from the RaspberryPi GPIO. Allows for users to write/use their own IO wrappers for different hardware solutions
## Special thanks
This library is built using [Stian Eikelands go-rpio library](https://github.com/stianeikeland/go-rpio).
## Changelog
### 25/01/2019
- Decoupled the lcd from synchronization
- Added a VIRTUAL LCD
- rewrote examples to match new code
### 5/11/2018
- Fixed boot bug: The LCD used to randomly show garbled data. It's fixed
- Better implementation of animations. Animations are now locked to a single line, allowing for animating both lines concurrently
- Added an example for the new animations