Open main menu

Wiki-Orange Pi β

Changes

Orange Pi Zero 3

584 bytes added, 15:38, 11 July 2023
26pin GPIO port test
=== 26pin GPIO port test ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''wiringOP-Python is the same as wiringOP, you can also determine which GPIO pin to operate by specifying the wPi number, because there is no command to check the wPi number in wiringOP-Python, so you can only check the board wPi number and physical Correspondence between pins.'''</big>
[[File:media/image172.png|575x365px]]
|}
<ol style="list-style-type: decimal;">
<li><p>The steps to test directly with the command are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First set the GPIO port to output mode, where the first &gt; parameter of the '''pinMode''' function is the serial number of &gt; the wPi corresponding to the pin, and the second parameter is &gt; the GPIO mode</p>{| class="wikitable" style="width:800px;" |-|
<p>root@orangepi:~/wiringOP-Python# '''python3 -c &quot;import wiringpi; \'''</p>
<p>'''from wiringpi import GPIO; wiringpi.wiringPiSetup() ; \'''</p>
<p>'''wiringpi.pinMode(<span style="color:#FF0000">2, GPIO.OUTPUT</span>) ; &quot;'''</p>|}</li><li><p>Then set the GPIO port to output low level. After setting, you &gt; can use a multimeter to measure the voltage value of the pin. &gt; If it is 0v, it means that the low level is set successfully.</p>{| class="wikitable" style="width:800px;" |-|
<p>root@orangepi:~/wiringOP-Python# '''python3 -c &quot;import wiringpi; \'''</p>
<p>'''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''</p>
<p>'''wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.LOW</span>)&quot;'''</p>|}</li><li><p>Then set the GPIO port to output a high level. After setting, &gt; you can use a multimeter to measure the voltage value of the &gt; pin. If it is 3.3v, it means that the high level is set &gt; successfully.</p>{| class="wikitable" style="width:800px;" |-|
<p>root@orangepi:~/wiringOP-Python# '''python3 -c &quot;import wiringpi; \'''</p>
<p>'''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''</p>
<p>'''wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.HIGH</span>)&quot;'''</p>|}</li></ol>
</li>
<li><p>The steps to test in the command line of python3 are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First use the python3 command to enter the command line mode of &gt; python3</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~# '''python3'''</p>|}</li>
<li><p>Then import the python module of wiringpi</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>&gt;&gt;&gt; '''import wiringpi'''</p>
<p>&gt;&gt;&gt; '''from wiringpi import GPIO'''</p>|}</li><li><p>Then set the GPIO port to output mode, where the first parameter &gt; of the '''pinMode''' function is the serial number of the wPi &gt; corresponding to the pin, and the second parameter is the GPIO &gt; mode</p>{| class="wikitable" style="width:800px;" |-|
<p>&gt;&gt;&gt; '''wiringpi.wiringPiSetup()'''</p>
<p>0</p>
<p>&gt;&gt;&gt; '''wiringpi.pinMode(<span style="color:#FF0000">2, GPIO.OUTPUT</span>)'''</p>|}</li><li><p>Then set the GPIO port to output low level. After setting, you &gt; can use a multimeter to measure the voltage value of the pin. &gt; If it is 0v, it means that the low level is set successfully.</p><p>&gt;&gt;&gt; '''wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.LOW</span>)'''</p></li><li><p>Then set the GPIO port to output a high level. After setting, &gt; you can use a multimeter to measure the voltage value of the &gt; pin. If it is 3.3v, it means that the high level is set &gt; successfully.</p><p>&gt;&gt;&gt; '''wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.HIGH</span>)'''</p></li></ol>
</li>
<li><p>The method of wiringOP-Python to set GPIO high and low levels in python code can refer to the '''blink.py''' test program in the examples below. The '''blink.py''' test program will set the voltage of all GPIO ports in the 26 pins of the development board to change continuously.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p>
<p>root@orangepi:~/wiringOP-Python/examples# '''ls blink.py'''</p>
<p>'''blink.py'''</p>
<p>root@orangepi:~/wiringOP-Python/examples'''# python3 blink.py'''</p>|}</li></ol>
<span id="pin-spi-test-1"></span>
 
=== 26pin SPI test ===