Easy-Python  1.00.00Change to: 中文
LED

Functions

 LED (id)
 Make new LED object. More...
 
 on ()
 Turn the LED on. More...
 
 off ()
 Turn the LED off. More...
 
 toggle ()
 Toggle the LED between on and off. More...
 

Detailed Description

The LED object controls an individual LED (Light Emitting Diode).

LED Example of Micropython
Click here
Example Code of usage:
from machine import LED
led=LED(LED.LED1)
led.on()
led.off()
led.toggle()

Function Documentation

LED ( id  )

Make new LED object.

Create an LED object associated with the given LED:

Parameters
[in]idis the LED number
  • LED.LED1 : selsct LED1
  • LED.LED2 : selsct LED2
  • LED.LED3 : selsct LED3
  • LED.LED4 : selsct LED4
Returns
(no)
Example of usage:
from machine import LED
led=LED(LED.LED1)
on ( )

Turn the LED on.

LED.on()

Parameters
no
Returns
(no)
Example of usage:
from machine import LED
led=LED(LED.LED1)
led.on()
off ( )

Turn the LED off.

LED.off()

Parameters
no
Returns
(no)
Example of usage:
from machine import LED
led=LED(LED.LED1)
led.off()
toggle ( )

Toggle the LED between on and off.

LED.toggle()

Parameters
no
Returns
(no)
Example of usage:
from machine import LED
led=LED(1)
led.toggle()