summaryrefslogtreecommitdiff
path: root/examples/std/src/bin/tick.rs
blob: 7de78040f5860165d829ccae4238ae32c0a66113 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#![feature(type_alias_impl_trait)]
#![allow(incomplete_features)]

use embassy::executor::Spawner;
use embassy::time::{Duration, Timer};
use log::*;

#[embassy::task]
async fn run() {
    loop {
        info!("tick");
        Timer::after(Duration::from_secs(1)).await;
    }
}

#[embassy::main]
async fn main(spawner: Spawner) {
    env_logger::builder()
        .filter_level(log::LevelFilter::Debug)
        .format_timestamp_nanos()
        .init();

    spawner.spawn(run()).unwrap();
}