diff options
| author | Ulf Lilleengen <[email protected]> | 2024-01-11 19:19:16 +0100 |
|---|---|---|
| committer | Ulf Lilleengen <[email protected]> | 2024-01-11 19:19:16 +0100 |
| commit | 3119aeec5cc05f78a6551ae845f2dbc659bb631a (patch) | |
| tree | bf75094c45ac886fa011a933b47530878067441b /examples/nrf9160/src/bin | |
| parent | ae84f2a157cf34c5bbc88ec4637f084f1ab924ea (diff) | |
add nrf9160 example (assumes SPM from zephyr)
Diffstat (limited to 'examples/nrf9160/src/bin')
| -rw-r--r-- | examples/nrf9160/src/bin/blinky.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/examples/nrf9160/src/bin/blinky.rs b/examples/nrf9160/src/bin/blinky.rs new file mode 100644 index 000000000..7ac5c31e1 --- /dev/null +++ b/examples/nrf9160/src/bin/blinky.rs | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | |||
| 4 | use embassy_executor::Spawner; | ||
| 5 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; | ||
| 6 | use embassy_time::Timer; | ||
| 7 | use {defmt_rtt as _, panic_probe as _}; | ||
| 8 | |||
| 9 | #[embassy_executor::main] | ||
| 10 | async fn main(_spawner: Spawner) { | ||
| 11 | let p = embassy_nrf::init(Default::default()); | ||
| 12 | let mut led = Output::new(p.P0_02, Level::Low, OutputDrive::Standard); | ||
| 13 | |||
| 14 | loop { | ||
| 15 | led.set_high(); | ||
| 16 | Timer::after_millis(300).await; | ||
| 17 | led.set_low(); | ||
| 18 | Timer::after_millis(300).await; | ||
| 19 | } | ||
| 20 | } | ||
