26 lines
625 B
Rust
26 lines
625 B
Rust
#![no_std]
|
|
#![no_main]
|
|
#![feature(type_alias_impl_trait)]
|
|
|
|
use embassy_executor::Spawner;
|
|
use embassy_rp::gpio::{Input, Level, Output, Pull};
|
|
use {defmt_rtt as _, panic_probe as _};
|
|
|
|
#[embassy_executor::main]
|
|
async fn main(_spawner: Spawner) {
|
|
let p = embassy_rp::init(Default::default());
|
|
let mut led = Output::new(p.PIN_25, Level::Low);
|
|
|
|
// Use PIN_28, Pin34 on J0 for RP Pico, as a input.
|
|
// You need to add your own button.
|
|
let button = Input::new(p.PIN_28, Pull::Up);
|
|
|
|
loop {
|
|
if button.is_high() {
|
|
led.set_high();
|
|
} else {
|
|
led.set_low();
|
|
}
|
|
}
|
|
}
|