Commit 9707b7e 1 parent 481ab5d commit 9707b7e Copy full SHA for 9707b7e
File tree 1 file changed +10
-2
lines changed
microbit/src/05-led-roulette
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:
25
25
use cortex_m_rt :: entry;
26
26
use rtt_target :: rtt_init_print;
27
27
use panic_rtt_target as _;
28
+ use embedded- hal :: delay :: DelayNS ;
28
29
use microbit :: {
29
30
board :: Board ,
30
31
display :: blocking :: Display ,
31
- hal :: { prelude :: * , Timer } ,
32
+ hal :: Timer ,
32
33
};
33
34
34
35
#[entry]
35
36
fn main () -> ! {
36
37
rtt_init_print! ();
37
38
38
39
let board = Board :: take (). unwrap ();
40
+
39
41
let mut timer = Timer :: new (board . TIMER0 );
40
42
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
+
41
47
let light_it_all = [
42
48
[1 , 1 , 1 , 1 , 1 ],
43
49
[1 , 1 , 1 , 1 , 1 ],
@@ -48,9 +54,11 @@ fn main() -> ! {
48
54
49
55
loop {
50
56
// 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
+
52
59
// clear the display again
53
60
display . clear ();
61
+
54
62
timer . delay_ms (1000_u32 );
55
63
}
56
64
}
You can’t perform that action at this time.
0 commit comments