class documentation

class LED:

Constructor: LED(pin)

View In Hierarchy

Class to control an LED on a Raspberry Pi Pico device.

Method __del__ Release the LED pin.
Method __init__ Initialize the LED on the default or given pin.
Method blink Blink the LED on and off for a specified duration.
Method off Turn the LED off.
Method on Turn the LED on.
Method toggle Toggle the LED state.
Instance Variable led The Pin object representing the LED.
def __del__(self):

Release the LED pin.

def __init__(self, pin: int = -1):

Initialize the LED on the default or given pin.

Parameters
pin:intPin number to use, or -1 for the board LED. Defaults to -1.
def blink(self, duration=0.5):

Blink the LED on and off for a specified duration.

Parameters
duration:floatHow long the LED stays on or off in seconds. Defaults to 0.5.
def off(self):

Turn the LED off.

def on(self):

Turn the LED on.

def toggle(self):

Toggle the LED state.

led: machine.Pin =

The Pin object representing the LED.