diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/nrf/src/bin/shared_bus.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/nrf/src/bin/shared_bus.rs b/examples/nrf/src/bin/shared_bus.rs new file mode 100644 index 000000000..23d16f796 --- /dev/null +++ b/examples/nrf/src/bin/shared_bus.rs | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | #![feature(type_alias_impl_trait)] | ||
| 4 | |||
| 5 | use embassy::executor::Spawner; | ||
| 6 | use embassy::time::{Duration, Timer}; | ||
| 7 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; | ||
| 8 | use embassy_nrf::Peripherals; | ||
| 9 | use {defmt_rtt as _, panic_probe as _}; | ||
| 10 | |||
| 11 | #[embassy::main] | ||
| 12 | async fn main(_spawner: Spawner, p: Peripherals) { | ||
| 13 | let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); | ||
| 14 | |||
| 15 | loop { | ||
| 16 | led.set_high(); | ||
| 17 | Timer::after(Duration::from_millis(300)).await; | ||
| 18 | led.set_low(); | ||
| 19 | Timer::after(Duration::from_millis(300)).await; | ||
| 20 | } | ||
| 21 | } | ||
