How to blink a led on the new esp_hal crate?

gruvineo
Posts: 6
Joined: Sun Dec 31, 2023 5:26 am

How to blink a led on the new esp_hal crate?

Postby gruvineo » Sun Sep 22, 2024 2:13 pm

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

SergioGasquez
Posts: 1
Joined: Wed Sep 25, 2024 12:40 pm

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

Postby SergioGasquez » Wed Sep 25, 2024 12:44 pm

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

Who is online

Users browsing this forum: No registered users and 3 guests