feat: lcd works (soldering issue) and print an int to the display
This commit is contained in:
parent
b56c8709d7
commit
d1f9420703
1 changed files with 19 additions and 3 deletions
|
@ -2,6 +2,7 @@
|
|||
#![no_std]
|
||||
|
||||
use defmt::info;
|
||||
use heapless::String;
|
||||
use panic_probe as _;
|
||||
|
||||
use defmt_rtt as _; // global logger
|
||||
|
@ -50,8 +51,8 @@ fn main() -> ! {
|
|||
.expect("could not init HD44780 driver");
|
||||
lcd.set_display_mode(
|
||||
hd44780_driver::DisplayMode {
|
||||
cursor_visibility: hd44780_driver::Cursor::Visible,
|
||||
cursor_blink: hd44780_driver::CursorBlink::On,
|
||||
cursor_visibility: hd44780_driver::Cursor::Invisible,
|
||||
cursor_blink: hd44780_driver::CursorBlink::Off,
|
||||
display: hd44780_driver::Display::On,
|
||||
},
|
||||
&mut delay,
|
||||
|
@ -62,10 +63,25 @@ fn main() -> ! {
|
|||
.expect("could not write to LCD");
|
||||
|
||||
let mut i = 0;
|
||||
let mut buf: String<20> = String::new();
|
||||
loop {
|
||||
led.set_high().unwrap();
|
||||
info!("Writing to LCD...");
|
||||
lcd.write_str("Hello world!\nGoing on", &mut delay)
|
||||
|
||||
lcd.clear(&mut delay).expect("could not clear the display");
|
||||
|
||||
lcd.set_cursor_pos(0, &mut delay)
|
||||
.expect("could not move cursor to start");
|
||||
lcd.write_str("Hello world!", &mut delay)
|
||||
.expect("could not write to LCD");
|
||||
|
||||
lcd.set_cursor_pos(20, &mut delay)
|
||||
.expect("could not move cursor to line 2");
|
||||
|
||||
buf.clear();
|
||||
write!(&mut buf, "Iteration: {i}").expect("could not format text content for display");
|
||||
|
||||
lcd.write_str(&buf, &mut delay)
|
||||
.expect("could not write to LCD");
|
||||
|
||||
info!("Done!");
|
||||
|
|
Loading…
Add table
Reference in a new issue