On for 1 second, off for 1 second
stop_circle
pink_led.blink() # start blinking
sleep(10) # runs immediately
pink_led.off() # stop blinking
lightbulb
Using .blink()
.blink() will make the LED start blinking.
lightbulb
Using .off()
.off() will stop the LED from blinking.
bug_report My LED doesn't blink
- Make sure you have imported the LED.
- Make sure you have set the pin number for the LED.
Customise the blink pattern
stop_circle
# Blink on 1s, off 0.5s
pink_led.blink(on_time=1, off_time=0.5)
sleep(8) # runs immediately
pink_led.off() # stops as soon as called
done
# blink on and off 5 times
pink_led.blink(n=5)
print("Blinking") # prints immediately