#![no_std]
#![no_main]

use esp_backtrace as _;
use esp_hal::{
    clock::CpuClock,
    delay::Delay,
    gpio::*,
    peripherals::Peripherals,
    prelude::*,
    main,
};

#[main]
fn main() -> ! {
    let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
    let peripherals = esp_hal::init(config);
    let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);

    let mut led = io.pins.gpio2.into_push_pull_output(); // Initialize GPIO2 as output
    let mut delay = Delay::new();

    loop {
        led.set_high().unwrap(); // Turn LED on
        delay.delay_millis(500);

        led.set_low().unwrap(); // Turn LED off
        delay.delay_millis(500);
    }
}