打开主菜单

Wiki-Orange Pi β

更改

Orange Pi 3B

添加428字节, 2023年8月3日 (四) 10:25
wiringOP-Python的安装方法
|}
</li>
<li><p>然后使用下面的命令下载wiringOP-Python的源码</p></li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| </olbig> '''注意,下面的git clone--recursive命令会自动下载wiringOP的源码,因为wiringOP-Python是依赖wiringOP的。请确保下载过程没有因为网络问题而报错。''' '''如果从GitHub下载代码有问题,可以直接使用Linux镜像中自带的wiringOP-Python源码,存放位置为:/usr/src/wiringOP-Python'''。
'''如果从GitHub下载代码有问题,可以直接使用Linux镜像中自带的wiringOP-Python源码,存放位置为:/usr/src/wiringOP-Python'''。</big>
|}
{| class="wikitable" style="width:800px;"
|-
|
root@orangepi:~# '''git clone --recursive https://github.com/orangepi-xunlong/wiringOP-Python -b next'''
root@orangepi:~/wiringOP-Python# '''git submodule update --init --remote'''
|}</ol>
<ol start="3" style="list-style-type: decimal;">
<li><p>然后使用下面的命令编译wiringOP-Python并将其安装到开发板的Linux系统中</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>root@orangepi:~# '''cd wiringOP-Python'''</p>
<p>root@orangepi:~/wiringOP-Python# '''python3 generate-bindings.py &gt; bindings.i'''</p>
<p>root@orangepi:~/wiringOP-Python# '''sudo python3 setup.py install'''</p>|}</li><li><p>然后输入下面的命令,如果有帮助信息输出,说明wiringOP-Python安装成功,按下'''q'''键可以退出帮助信息的界面</p></li></ol>
{| class="wikitable" style="width:800px;"
|-
|
root@orangepi:~/wiringOP-Python# '''python3 -c &quot;import wiringpi; help(wiringpi)&quot;'''
Help on module wiringpi:
 
NAME
:wiringpi 
DESCRIPTION
:# This file was automatically generated by SWIG (http://www.swig.org). # Version 4.0.2
:#Version 4.0.2
:# Do not make changes to this file unless you know what you are doing--modify
:# the SWIG interface Do not make changes to this file instead.unless you know what you are doing--modify
:# the SWIG interface file instead.
|}
</ol>
<ol start="5" style="list-style-type: decimal;">
<li><p>在python命令行下测试wiringOP-Python是否安装成功的步骤如下所示:</p>
<ol style="list-style-type: lower-alpha;">
<li>首先使用python3命令进入python3的命令行模式</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~# '''python3'''
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>然后导入wiringpi的python模块</li></ol>{| class="wikitable" style="width:800px;" |-|
&gt;&gt;&gt; '''import wiringpi;'''
|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>最后输入下面的命令可以查看下wiringOP-Python的帮助信息,按下'''q'''键可以退出帮助信息的界面</li></ol>{| class="wikitable" style="width:800px;" |-|
&gt;&gt;&gt; '''help(wiringpi)'''
Help on module wiringpi:
 
NAME
:wiringpi 
DESCRIPTION
:# This file was automatically generated by SWIG (http://www.swig.org). :# Version 4.0.2
:# Version 4.0.2
:#Do not make changes to this file unless you know what you are doing--modify
:# Do not make changes to this the SWIG interface file unless you know what you are doing--modifyinstead.
# the SWIG interface file instead.
CLASSES
:builtins.object ::GPIO
GPIO::I2C
I2C::Serial
Serial::nes
nes
:class GPIO(builtins.object)
:| GPIO(pinmode=0) :|
|
&gt;&gt;&gt;
|}
</ol>
</li></ol>
<span id="pin-gpio口测试-1"></span>
<span id="pin-gpio口测试-1"></span>
=== 40pin GPIO口测试 ===
8,460
个编辑