#![no_std]
#![no_main]

use esp_idf_hal::gpio::{Gpio2, Output, OutputPin};
use esp_idf_hal::prelude::*;
use esp_idf_sys::EspError;
use std::thread::sleep;
use std::time::Duration;

#[entry]
fn main() -> Result<(), EspError> {
    esp_idf_sys::link_patches();

    let peripherals = Peripherals::take().unwrap();
    let pins = peripherals.pins;

    let mut led = pins.gpio2.into_output().unwrap();

    loop {
        led.set_high()?;
        sleep(Duration::from_millis(500));
        led.set_low()?;
        sleep(Duration::from_millis(500));
    }
}