清空記錄
歷史記錄
取消
清空記錄
歷史記錄
玩法豐富,支持OpenHarmony、Ubuntu、Debian、Android等多種系統(tǒng),提供豐富開源資料。
產(chǎn)品規(guī)格書:Purple Pi OH 產(chǎn)品手冊(cè)
apt-get update
apt -y install python3-libgpiod
import time
import gpiod
//B7=15
LINE_OFFSET =15
chip0 = gpiod.Chip("0", gpiod.Chip.OPEN_BY_NUMBER)
gpio0_b0 = chip0.get_line(LINE_OFFSET)
gpio0_b0.request(consumer="gpio", type=gpiod.LINE_REQ_DIR_OUT, default_vals=[0])
print(gpio0_b0.consumer())
try:
while True:
gpio0_b0.set_value(1)
time.sleep(0.5)
gpio0_b0.set_value(0)
time.sleep(0.5)
finally:
gpio0_b0.set_value(1)
gpio0_b0.release()
我們通過(guò)萬(wàn)用表檢測(cè)該引腳的電壓是否會(huì)在高低電壓中進(jìn)行反復(fù)橫跳
GPIO15對(duì)應(yīng)的位置在11
import time
import gpiod
LINE_OFFSET =23
chip0 = gpiod.Chip("0",gpiod.Chip.OPEN_BY_NUMBER)
gpio0_b7 = chip0.get_line(LINE_OFFSET)
gpio0_b7.request(consumer="gpio", type=gpiod.LINE_REQ_DIR_IN, default_vals=[0])
try:
while True:
value = gpio0_b7.get_value()
time.sleep(0.5)
print("gpio status: ",value)
finally:
gpio0_b7.release()
chip.close