Skip to content

Commit

Permalink
examples: uno: Use toggle from embedded-hal 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ghismary authored Jan 30, 2024
1 parent 8493b5c commit eb818ae
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions examples/arduino-uno/src/bin/uno-blink-embedded-hal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,19 @@
#![no_main]

use embedded_hal::delay::DelayNs;
use embedded_hal::digital::OutputPin;
use embedded_hal::digital::StatefulOutputPin;

use panic_halt as _;

fn blink(led: &mut impl OutputPin, delay: &mut impl DelayNs) -> ! {
fn blink(led: &mut impl StatefulOutputPin, delay: &mut impl DelayNs) -> ! {
loop {
// TODO: once embedded-hal v1.0.0 is released switch to `StatefulOutputPin` & use `toggle` (not part of RC 3)
led.set_low().unwrap();
led.toggle().unwrap();
delay.delay_ms(100);
led.set_high().unwrap();
led.toggle().unwrap();
delay.delay_ms(100);
led.set_low().unwrap();
led.toggle().unwrap();
delay.delay_ms(100);
led.set_high().unwrap();
led.toggle().unwrap();
delay.delay_ms(800);
}
}
Expand Down

0 comments on commit eb818ae

Please sign in to comment.