File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
microbit/src/05-led-roulette Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -25,19 +25,25 @@ you can use the display API provided by the BSP. It works like this:
2525use cortex_m_rt :: entry;
2626use rtt_target :: rtt_init_print;
2727use panic_rtt_target as _;
28+ use embedded- hal :: delay :: DelayNS ;
2829use microbit :: {
2930 board :: Board ,
3031 display :: blocking :: Display ,
31- hal :: { prelude :: * , Timer } ,
32+ hal :: Timer ,
3233};
3334
3435#[entry]
3536fn main () -> ! {
3637 rtt_init_print! ();
3738
3839 let board = Board :: take (). unwrap ();
40+
3941 let mut timer = Timer :: new (board . TIMER0 );
4042 let mut display = Display :: new (board . display_pins);
43+
44+ // Setup the display delay so the math works as expected later.
45+ display . set_delay_ms (1 );
46+
4147 let light_it_all = [
4248 [1 , 1 , 1 , 1 , 1 ],
4349 [1 , 1 , 1 , 1 , 1 ],
@@ -48,9 +54,11 @@ fn main() -> ! {
4854
4955 loop {
5056 // Show light_it_all for 1000ms
51- display . show (& mut timer , light_it_all , 1000 );
57+ display . show (& mut timer , light_it_all , 1_000 );
58+
5259 // clear the display again
5360 display . clear ();
61+
5462 timer . delay_ms (1000_u32 );
5563 }
5664}
You can’t perform that action at this time.
0 commit comments