diff options
Diffstat (limited to 'examples/rp/src/bin/button.rs')
| -rw-r--r-- | examples/rp/src/bin/button.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/examples/rp/src/bin/button.rs b/examples/rp/src/bin/button.rs index c5422c616..d7aa89410 100644 --- a/examples/rp/src/bin/button.rs +++ b/examples/rp/src/bin/button.rs | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | //! This example uses the RP Pico on board LED to test input pin 28. This is not the button on the board. | ||
| 2 | //! | ||
| 3 | //! It does not work with the RP Pico W board. Use wifi_blinky.rs and add input pin. | ||
| 4 | |||
| 1 | #![no_std] | 5 | #![no_std] |
| 2 | #![no_main] | 6 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 7 | #![feature(type_alias_impl_trait)] |
| @@ -9,9 +13,12 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 9 | #[embassy_executor::main] | 13 | #[embassy_executor::main] |
| 10 | async fn main(_spawner: Spawner) { | 14 | async fn main(_spawner: Spawner) { |
| 11 | let p = embassy_rp::init(Default::default()); | 15 | let p = embassy_rp::init(Default::default()); |
| 12 | let button = Input::new(p.PIN_28, Pull::Up); | ||
| 13 | let mut led = Output::new(p.PIN_25, Level::Low); | 16 | let mut led = Output::new(p.PIN_25, Level::Low); |
| 14 | 17 | ||
| 18 | // Use PIN_28, Pin34 on J0 for RP Pico, as a input. | ||
| 19 | // You need to add your own button. | ||
| 20 | let button = Input::new(p.PIN_28, Pull::Up); | ||
| 21 | |||
| 15 | loop { | 22 | loop { |
| 16 | if button.is_high() { | 23 | if button.is_high() { |
| 17 | led.set_high(); | 24 | led.set_high(); |
