From 5b4ad733c1a8fb01f97d702b6cd8a3a7f228f3de Mon Sep 17 00:00:00 2001 From: xyj <10908227994@qq.com> Date: Tue, 26 Dec 2023 17:06:05 +0800 Subject: [PATCH] update --- test_led.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/test_led.py b/test_led.py index 8878675..e9a752a 100644 --- a/test_led.py +++ b/test_led.py @@ -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) \ No newline at end of file +#led.value = 0 #输出低电平,熄灭板载LED蓝灯 \ No newline at end of file