# Import necessary modules
# 導入必要的模組
from machine import Pin
import time
# Initialize a Pin object to interact with GPIO 21,
#and set it as an output pin
# 初始化一個 Pin 物件來操作 GPIO 21,並將它設為輸出腳位
led = Pin(21, Pin.OUT)
# Print the initial value (level) of the LED (either 0 or 1)
# 列印 LED 的初始電位,即 0 或 1
print(f"LED init level is {led.value()}")
# Pause the execution of the program for 1 second
# 暫停程式的執行 1 秒
time.sleep(1)
# Set the LED value to 0 (turn it off)
# 將 LED 電位設為 1(關閉它)
led.value(1)
time.sleep(1)
# Set the LED value to 1 (turn it on)
# 將 LED 電位設為 0(打開它)
led.value(0)
time.sleep(1)
# Set the LED value to 0 (turn it off)
# 將 LED 電位設為 1(關閉它)
led.value(1)
time.sleep(1)