/*
Simplified Embedded Rust: ESP Core Library Edition
Programming GPIO - Blinky Application Example
*/
#![no_std]
#![no_main]
use esp_backtrace as _;
use esp_hal::{
delay::Delay,
gpio::{Level, Output},
prelude::*,
};
#[entry]
fn main() -> ! {
// Take the peripherals
let peripherals =
esp_hal::init(esp_hal::Config::default());
// Create a delay handle
let delay = Delay::new();
// Create output pin
let mut led_pin =
Output::new(peripherals.GPIO1, Level::Low);
loop {
// Turn on LED
led_pin.set_high();
// Wait for 1 second
delay.delay_millis(1000u32);
// Turn off LED
led_pin.set_low();
// Wait for 1 second
delay.delay_millis(1000u32);
}
}
Loading
esp32-c3-devkitm-1
esp32-c3-devkitm-1