-
Notifications
You must be signed in to change notification settings - Fork 0
Home
"r4lcd" or "Rust for lcd" is a library for using hd44780 and hd44780 compatible lcds on raspberry pis in rust!( for full compatibility list check rppal
use r4lcd as lcd;
fn main() {
let mut pins = lcd::Pins::new();
lcd::begin(&mut pins, 2);
lcd::settings(&mut pins, lcd::Options::On, lcd::Options::On);
}Well lcd::Pins::new(); returns a struct with the pins which your device will use to communicate to the lcd with.
lcd::begin(&mut pins, 2); runs sends some basic instructions to the lcd to "start" it.
&mut pins is used by mostly every function. I'ts use to specify which pins you want to use.
The number is the amount of lines your display has, currently only 1 and 2 line displays are supported because I do not own a 4 line display.
lcd::settings is for changing the lcd settings, the arguments are (pin, cursor_mode, power).
cursor_mode is to change the cursor mode. The available modes are: On, Off and Blinking.
´power´ is to change the lcd screen power. The available modes are: On and Off.
To change the settings you use the lcd::Options enum.
It contains On, Blink, Off.
lcd::write(&mut pins, "Hello world!");lcd::write(); can write simple ascii characters to the lcd screen