aboutsummaryrefslogtreecommitdiff
path: root/examples/rp/src/bin/button.rs
diff options
context:
space:
mode:
authorQuentin Smith <[email protected]>2023-07-17 21:31:43 -0400
committerQuentin Smith <[email protected]>2023-07-17 21:31:43 -0400
commit6f02403184eb7fb7990fb88fc9df9c4328a690a3 (patch)
tree748f510e190bb2724750507a6e69ed1a8e08cb20 /examples/rp/src/bin/button.rs
parentd896f80405aa8963877049ed999e4aba25d6e2bb (diff)
parent6b5df4523aa1c4902f02e803450ae4b418e0e3ca (diff)
Merge remote-tracking branch 'origin/main' into nrf-pdm
Diffstat (limited to 'examples/rp/src/bin/button.rs')
-rw-r--r--examples/rp/src/bin/button.rs9
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]
10async fn main(_spawner: Spawner) { 14async 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();