Brighten for 1 second, fade for 1 second
stop_circle
pink_led.pulse() # start pulsing
sleep(6) # runs immediately
pink_led.off() # stop pulsing
lightbulb
Using .pulse()
.pulse() will make the LED start fading in and out (pulsing).
lightbulb
Using .off()
.off() will stop the LED from fading in and out (pulsing).
bug_report My LED doesn't pulse
- Make sure you have imported the LED.
- Make sure you have set the pin number for the LED.
Customise the pulse pattern
stop_circle
# 2s to brighten 1s to fade
red_led.pulse(fade_in_time=2, fade_out_time=1)
sleep(7) # runs immediately
red_led.off() # stops as soon as called
done
# pulse twice
purple_led.pulse(n=2)