Add led toggle

This commit is contained in:
Sofia 2026-05-12 19:25:55 +03:00
parent 7644dfedcd
commit a80997fa63

View File

@ -9,6 +9,7 @@
use esp_hal::{ use esp_hal::{
clock::CpuClock, clock::CpuClock,
gpio::{Output, OutputConfig},
main, main,
time::{Duration, Instant}, time::{Duration, Instant},
}; };
@ -54,8 +55,15 @@ fn main() -> ! {
esp_alloc::heap_allocator!(#[esp_hal::ram(reclaimed)] size: 98768); esp_alloc::heap_allocator!(#[esp_hal::ram(reclaimed)] size: 98768);
let mut led = Output::new(
peripherals.GPIO21,
esp_hal::gpio::Level::High,
OutputConfig::default(),
);
loop { loop {
log::info!("Hello world!"); log::info!("Hello world!");
led.toggle();
let delay_start = Instant::now(); let delay_start = Instant::now();
while delay_start.elapsed() < Duration::from_millis(500) {} while delay_start.elapsed() < Duration::from_millis(500) {}
} }