embedded-trainings-2020/beginner/apps/src/bin/blinky.rs

28 lines
649 B
Rust
Raw Normal View History

2020-06-09 09:52:27 +00:00
#![no_main]
#![no_std]
use core::time::Duration;
use cortex_m_rt::entry;
2021-04-08 12:16:26 +00:00
// this imports `beginner/apps/lib.rs` to retrieve our global logger + panicking-behavior
use apps as _;
2020-06-09 09:52:27 +00:00
#[entry]
fn main() -> ! {
2021-04-14 10:14:41 +00:00
// to enable more verbose logs, go to your `Cargo.toml` and set defmt logging levels
// to `defmt-trace` by changing the `default = []` entry in `[features]`
2020-06-09 09:52:27 +00:00
let board = dk::init().unwrap();
let mut led = board.leds._1;
let mut timer = board.timer;
for _ in 0..10 {
led.toggle();
timer.wait(Duration::from_secs(1));
2021-04-08 09:27:00 +00:00
defmt::info!("LED toggled at {:?}", dk::uptime());
2020-06-09 09:52:27 +00:00
}
dk::exit()
}