Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Delay

The way the delay is currently written is a bit verbose. We can simplify the code by using Delay from the esp_hal crate.

Add the following line next to the existing use declarations:

#![allow(unused)]
fn main() {
use esp_hal::delay::Delay;
}

Create a delay variable:

#![allow(unused)]
fn main() {
let delay = Delay::new();
}

Replace the two lines using delay_start with the following one line:

#![allow(unused)]
fn main() {
delay.delay_millis(1000);
}