embassy/examples/std/src/bin/tick.rs
2022-08-18 01:22:30 +02:00

24 lines
477 B
Rust

#![feature(type_alias_impl_trait)]
use embassy_executor::Spawner;
use embassy_time::{Duration, Timer};
use log::*;
#[embassy_executor::task]
async fn run() {
loop {
info!("tick");
Timer::after(Duration::from_secs(1)).await;
}
}
#[embassy_executor::main]
async fn main(spawner: Spawner) {
env_logger::builder()
.filter_level(log::LevelFilter::Debug)
.format_timestamp_nanos()
.init();
spawner.spawn(run()).unwrap();
}