This commit is contained in:
xyj 2023-12-26 17:06:05 +08:00
parent ef27088192
commit 5b4ad733c1
1 changed files with 12 additions and 12 deletions

View File

@ -1,16 +1,16 @@
import time
'''
实验名称点亮第1个LED
实验平台核桃派
'''
#导入相关模块
import board
import digitalio
from digitalio import DigitalInOut, Direction
PIN = board.CS1
#构建LED对象和初始化
led = DigitalInOut(board.LED) #定义引脚编号
led.direction = Direction.OUTPUT #IO为输出
print("hello blinky!")
led.value = 1 #输出高电平点亮板载LED蓝灯
led = digitalio.DigitalInOut(PIN)
led.direction = digitalio.Direction.OUTPUT
while True:
led.value = True
time.sleep(0.5)
led.value = False
time.sleep(0.5)
#led.value = 0 #输出低电平熄灭板载LED蓝灯