GPIO
— 控制I/O引脚¶
使用示例::(python)¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # coding=utf-8
# This is a sample Python script.
import utime
from driver import GPIO
print("start led test")
gpio = GPIO()
leds=("led1", "led2", "led3", "led4", "led5")
for i in range(5):
for led in leds:
gpio.open(led)
gpio.write(1)
utime.sleep_ms(200)
gpio.write(0)
utime.sleep_ms(200)
gpio.write(1)
utime.sleep_ms(200)
gpio.close()
print("end led test")
|
配置信息::(json)¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | # coding=utf-8
# This is a sample cjson file.
{
"version": "1.0.0",
"io": {
"led1": {
"type": "GPIO",
"port": 34,
"dir": "output",
"pull": "pullup"
},
"led2": {
"type": "GPIO",
"port": 35,
"dir": "output",
"pull": "pullup"
},
"led3": {
"type": "GPIO",
"port": 36,
"dir": "output",
"pull": "pullup"
},
"led4": {
"type": "GPIO",
"port": 40,
"dir": "output",
"pull": "pullup"
},
"led5": {
"type": "GPIO",
"port": 41,
"dir": "output",
"pull": "pullup"
}
},
"debugLevel": "DEBUG"
}
|