Pi Pico - LED Control
LED Toggle:
|
from machine import Pin led = Pin( 25, Pin.OUT ) led.toggle() |
LED Control:
|
from machine import Pin from time import sleep led = Pin( 25, Pin.OUT ) for i in range(10): led.high() sleep(1) led.low() sleep(1) |
LED Blink:
|
from machine import Pin, Timer led = Pin( 25, Pin.OUT ) timer = Timer() def blink( timer ): led.toggle() timer.init( freq = 20, mode = Timer.PERIODIC, callback = blink ) |
LED - External LED with Resistor:
|
from machine import Pin from time import sleep led = Pin( 15, Pin.OUT ) for i in range(10): led.high() sleep(1) led.low() sleep(1) |