update
This commit is contained in:
parent
ef27088192
commit
5b4ad733c1
24
test_led.py
24
test_led.py
|
@ -1,16 +1,16 @@
|
||||||
import time
|
'''
|
||||||
|
实验名称:点亮第1个LED
|
||||||
|
实验平台:核桃派
|
||||||
|
'''
|
||||||
|
|
||||||
|
#导入相关模块
|
||||||
import board
|
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.value = 0 #输出低电平,熄灭板载LED蓝灯
|
||||||
led.direction = digitalio.Direction.OUTPUT
|
|
||||||
|
|
||||||
while True:
|
|
||||||
led.value = True
|
|
||||||
time.sleep(0.5)
|
|
||||||
led.value = False
|
|
||||||
time.sleep(0.5)
|
|
Loading…
Reference in New Issue