737: Fix example r=korken89 a=datdenkikniet



Co-authored-by: datdenkikniet <jcdra1@gmail.com>
This commit is contained in:
bors[bot] 2023-04-17 05:58:54 +00:00 committed by GitHub
commit 688ba1cf5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -103,13 +103,23 @@ mod app {
#[task(local = [i2c, led])]
async fn heartbeat(ctx: heartbeat::Context) {
// Loop forever.
//
// It is important to remember that tasks that loop
// forever should have an `await` somewhere in that loop.
//
// Without the await, the task will never yield back to
// the async executor, which means that no other lower or
// equal priority task will be able to run.
loop {
// Flicker the built-in LED
_ = ctx.local.led.toggle();
// Congrats, you can use your i2c and have access to it here,
// now to do something with it!
// Re-spawn this task after 1 second
// Delay for 1 second
Timer::delay(1000.millis()).await;
}
}
}