from machine import Pin
import time

dot = 0.25  # 点的时间
dash = 1.0  # 杠的时间
gap = 0.2  # 点与点和杠与杠之间的延迟
letterDelay = 0.5  # 每个字母之间的间隔时间
ON = 1  # 亮灯
OFF = 0  # 熄灯

LED = Pin(4, Pin.OUT)  # 端口4
while True:
    for i in range(0, 3):
        LED.value(ON)
        time.sleep(dot)
        LED.value(OFF)
        time.sleep(gap)
        
    time.sleep(letterDelay)
    
    for i in range(0, 3):
        LED.value(ON)
        time.sleep(dash)
        LED.value(OFF)
        time.sleep(gap)
    
    time.sleep(letterDelay)
    
    for i in range(0, 3):
        LED.value(ON)
        time.sleep(dot)
        LED.value(OFF)
        time.sleep(gap)
    
    time.sleep(letterDelay)
Loading
esp32-s3-devkitc-1