How to Use Embassy for Async Embedded Rust

Embassy enables async programming on embedded devices by providing a runtime to execute async functions without an OS.

Embassy is an async runtime for embedded Rust that executes async functions without an operating system. Add embassy-executor to your Cargo.toml and spawn tasks using #[embassy_executor::main].

[dependencies]
embassy-executor = { version = "0.7", features = ["task-arena-size-65536"] }
use embassy_executor::Spawner;

#[embassy_executor::main]
async fn main(_spawner: Spawner) {
    // Your async logic here
}