pwm() can be any number from 0 to 100. pwm(100) is full power, pwm(50) is half, pwm(10) is a tiny glow.
setup: loop: o1 = pwm(100) wait(1000) o1 = pwm(50) wait(1000) o1 = pwm(10) wait(1000)
A smooth fade
output_increment_till(o1, 0, 100, 5, 50) climbs from 0 to 100 in steps of 5, waiting 50 ms between steps. output_decrement_till goes back down.
setup: loop: output_increment_till(o1, 0, 100, 5, 50) output_decrement_till(o1, 100, 0, 5, 50)
🚀 Your turn
Make the fade slower by changing the last number from 50 to 100.