#![no_std] #![no_main] use esp_backtrace as _; use esp_hal::{ gpio::{Input, Level, Output, Pull}, main, }; use esp_println::println; #[main] fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); println!("Hello world!"); // Set GPIO7 as an output, and set its state high initially. let mut led = Output::new(peripherals.GPIO1, Level::Low); let button = Input::new(peripherals.GPIO3, Pull::Up); // Check the button state and set the LED state accordingly. loop { if button.is_high() { println!("high"); led.set_high(); } else { println!("low"); led.set_low(); } } }