Skip to content

Commit

Permalink
Simplify pwm_blink examples
Browse files Browse the repository at this point in the history
  • Loading branch information
jannic committed Dec 21, 2023
1 parent 8e074f3 commit 2b535ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions rp2040-hal/examples/pwm_blink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ fn main() -> ! {
// Infinite loop, fading LED up and down
loop {
// Ramp brightness up
for i in (LOW..=HIGH).skip(100) {
for i in LOW..=HIGH {
delay.delay_us(8);
channel.set_duty(i);
}

// Ramp brightness down
for i in (LOW..=HIGH).rev().skip(100) {
for i in (LOW..=HIGH).rev() {
delay.delay_us(8);
channel.set_duty(i);
}
Expand Down
4 changes: 2 additions & 2 deletions rp2040-hal/examples/pwm_blink_embedded_hal_1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ fn main() -> ! {
// Infinite loop, fading LED up and down
loop {
// Ramp brightness up
for i in (LOW..=HIGH).skip(100) {
for i in LOW..=HIGH {
delay.delay_us(8);
channel.set_duty_cycle(i).unwrap();
}

// Ramp brightness down
for i in (LOW..=HIGH).rev().skip(100) {
for i in (LOW..=HIGH).rev() {
delay.delay_us(8);
channel.set_duty_cycle(i).unwrap();
}
Expand Down

0 comments on commit 2b535ec

Please sign in to comment.