Friday, 27 January 2023

1LED project on Raspberry Pi Pico

from picozero import LED from time import sleep yellow = LED(13) yellow.on() sleep(2) yellow.off() print("led ON") #yellow.blink() # on for 1 second then off for one second sleep(1) yellow.blink(on_time=1, off_time=0.5, n=3, wait=True) yellow.off() print("Finished blinking") # Runs after 3 on/off blinks sleep(1) yellow.pulse() # take 1 second to brighten and 1 second to dim sleep(3) yellow.off() print("Pulsing") # Runs immediately sleep(1) yellow.pulse(fade_in_time=3, fade_out_time=3, n=4, wait=True) # take 2 seconds to brighten and 1 second to dim sleep(3) yellow.off() print("Finished pulsing") # Runs after 4 pulses sleep(1) yellow.blink(on_time=1, off_time=1, fade_in_time=3, fade_out_time=3) # On for 1 second, off for 1 second, fade between sleep(3) yellow.off() print("Fancy") # Runs immediately #https://projects.raspberrypi.org/en/projects/introduction-to-the-pico/7

No comments: