diff options
| author | Curly <[email protected]> | 2025-02-23 07:33:58 -0800 |
|---|---|---|
| committer | Curly <[email protected]> | 2025-02-23 07:33:58 -0800 |
| commit | 3932835998802fc3abf7cce4f736e072858ebfd1 (patch) | |
| tree | 5dd714b99bc74a03556c58809237c88691c293bb /examples/rp235x/src/bin/blinky.rs | |
| parent | c3c67db93e627a4fafe5e1a1123e5cbb4abafe47 (diff) | |
rename `rp23` (?) folder to `rp235x`; fix `ci.sh` to use `rp235x` folder
Diffstat (limited to 'examples/rp235x/src/bin/blinky.rs')
| -rw-r--r-- | examples/rp235x/src/bin/blinky.rs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/examples/rp235x/src/bin/blinky.rs b/examples/rp235x/src/bin/blinky.rs new file mode 100644 index 000000000..2d962baca --- /dev/null +++ b/examples/rp235x/src/bin/blinky.rs | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | //! This example test the RP Pico on board LED. | ||
| 2 | //! | ||
| 3 | //! It does not work with the RP Pico W board. See wifi_blinky.rs. | ||
| 4 | |||
| 5 | #![no_std] | ||
| 6 | #![no_main] | ||
| 7 | |||
| 8 | use defmt::*; | ||
| 9 | use embassy_executor::Spawner; | ||
| 10 | use embassy_rp::gpio; | ||
| 11 | use embassy_time::Timer; | ||
| 12 | use gpio::{Level, Output}; | ||
| 13 | use {defmt_rtt as _, panic_probe as _}; | ||
| 14 | |||
| 15 | // Program metadata for `picotool info`. | ||
| 16 | // This isn't needed, but it's recomended to have these minimal entries. | ||
| 17 | #[link_section = ".bi_entries"] | ||
| 18 | #[used] | ||
| 19 | pub static PICOTOOL_ENTRIES: [embassy_rp::binary_info::EntryAddr; 4] = [ | ||
| 20 | embassy_rp::binary_info::rp_program_name!(c"Blinky Example"), | ||
| 21 | embassy_rp::binary_info::rp_program_description!( | ||
| 22 | c"This example tests the RP Pico on board LED, connected to gpio 25" | ||
| 23 | ), | ||
| 24 | embassy_rp::binary_info::rp_cargo_version!(), | ||
| 25 | embassy_rp::binary_info::rp_program_build_attribute!(), | ||
| 26 | ]; | ||
| 27 | |||
| 28 | #[embassy_executor::main] | ||
| 29 | async fn main(_spawner: Spawner) { | ||
| 30 | let p = embassy_rp::init(Default::default()); | ||
| 31 | let mut led = Output::new(p.PIN_25, Level::Low); | ||
| 32 | |||
| 33 | loop { | ||
| 34 | info!("led on!"); | ||
| 35 | led.set_high(); | ||
| 36 | Timer::after_millis(250).await; | ||
| 37 | |||
| 38 | info!("led off!"); | ||
| 39 | led.set_low(); | ||
| 40 | Timer::after_millis(250).await; | ||
| 41 | } | ||
| 42 | } | ||
