diff --git a/examples/lcd-clock.rs b/examples/lcd-clock.rs index c4104ae..eff3cd4 100755 --- a/examples/lcd-clock.rs +++ b/examples/lcd-clock.rs @@ -106,10 +106,10 @@ fn display_time(rtc: &mut Rtc, lcd: &mut Lcd, delay: &mut Delay, buf: &mut Strin buf.clear(); write!( buf, - " {:02}:{:02}:{:02} ", - timestamp.hour(), - timestamp.minute(), - timestamp.second() + " {:04}-{:02}-{:02} ", + timestamp.year(), + timestamp.month(), + timestamp.day() ) .expect("could not format text content for display"); lcd.write_str(buf, delay).expect("could not write to LCD"); @@ -120,12 +120,11 @@ fn display_time(rtc: &mut Rtc, lcd: &mut Lcd, delay: &mut Delay, buf: &mut Strin buf.clear(); write!( buf, - " {:04}-{:02}-{:02} ", - timestamp.year(), - timestamp.month(), - timestamp.day() + " {:02}:{:02}:{:02} ", + timestamp.hour(), + timestamp.minute(), + timestamp.second() ) .expect("could not format text content for display"); - lcd.write_str(buf, delay).expect("could not write to LCD"); } diff --git a/examples/lcd.rs b/examples/lcd.rs index 4c84770..7a929c2 100755 --- a/examples/lcd.rs +++ b/examples/lcd.rs @@ -84,6 +84,17 @@ fn main() -> ! { lcd.write_str(&buf, &mut delay) .expect("could not write to LCD"); + lcd.set_cursor_pos(60, &mut delay) + .expect("could not move cursor to start"); + lcd.write_str(" Line 2 ", &mut delay) + .expect("could not write to LCD"); + + // line 4 is a bit strange and eats the first few spaces + lcd.set_cursor_pos(80, &mut delay) + .expect("could not move cursor to start"); + lcd.write_str(" Line 4 ", &mut delay) + .expect("could not write to LCD"); + info!("Done!"); led.set_low().unwrap();