Page 1 of 1

How to blink a led on the new esp_hal crate?

Posted: Sun Sep 22, 2024 2:13 pm
by gruvineo
I bought an esp32-h2 with an RGB led that says RGB@IO8 so I did

Code: Select all

#[esp_hal_embassy::main]
async fn main(_spawner: Spawner) -> ! {
    let mut peripherals = Peripherals::take();
    let system = SystemControl::new(peripherals.SYSTEM);
    //...
    let clocks = ClockControl::max(system.clock_control).freeze();
    let mut io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
    io.pins.gpio8.set_high();
    loop {
    //...
   }
}
but it does not turn on.

How to make it work? Could it be that since it's RGB, I have to control it differently?

I couldn't find any examples on the new crate, just the old ones that are deprecated

Re: How to blink a led on the new esp_hal crate?

Posted: Wed Sep 25, 2024 12:44 pm
by SergioGasquez
Hi! As you mentioned, it looks like you are trying to light an RGB LED, I'd suggest taking a look at https://github.com/esp-rs/esp-hal-commu ... llo_rgb.rs.

Also, I'd recommend joining our Matrix channel for similar questions: https://matrix.to/#/#esp-rs:matrix.org