[Document sharing]-Light Up LED Lights


After the quick start of QuecPython, this document introduces how to light an LED.

Light an LED

Hardware Connection

  1. Prepare one LED and two Dupont lines
  2. Connect the ground end (flag end) of the LED to GND with Dupont line
  3. Connect the other end of the LED to GPIO with Dupont line

Here is an example:

Software Code

import utime # import utime module
from machine import Pin # import Pin module

gpio_x = Pin(Pin.GPIO4, Pin.OUT, Pin.PULL_PU, 0) # GPIO is configured in output mode with 0 output by default

count = 30
state = 1
while count:
print(‘LED state: {}’.format(state))
if state == 1:
state = 0
state = 1
count -= 1

Running Result