//! This shows how to write text to UART0. //! //! You can see the output with `espflash` if you provide the `--monitor` //! option. //! //! Depending on the chip, you will need to ensure that you are connected to //! the UART USB port, and not the USB-SERIAL-JTAG port. If you want to test //! printing over USB-SERIAL-JTAG, try the usb_serial_jtag example instead. //% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3 #![no_std] #![no_main] use core::fmt::Write; use esp_backtrace as _; use esp_hal::{ clock::ClockControl, delay::Delay, peripherals::Peripherals, prelude::*, uart::Uart, }; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let delay = Delay::new(&clocks); let mut uart0 = Uart::new(peripherals.UART0, &clocks); loop { writeln!(uart0, "Hello world!").unwrap(); delay.delay(1.secs()); } }