8,367
edits
Changes
→40pin GPIO port test
=== 40pin 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 pink can be determined by specifying the WPI number. Because there is no command to check the WPI number in Wiringop-Python, you can only check the board WPI number and physical physical physics through the GPIO command in Wiringop. The corresponding relationship of the pin.'''</big>
<div class="figure">
[[File:pi3b-img258.png|center]]
</div>
|}
# Below the No. 7 pin — corresponding to GPIO4_a4 -corresponding WPI serial number 2 -to demonstrate how to set the height of the GPIO port
::[[File:pi3b-img259.png]]
<ol start="2" style="list-style-type: decimal;">
<li><p>The steps of the command test are shown below directly: </p>
<ol style="list-style-type: lower-alpha;">
<li>First set the GPIO port to the output mode. The first parameter of the '''pinMode''' function is the serial number of the wpi corresponding to the pin, and the second parameter is the GPIO mode</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~/wiringOP-Python# '''python3 -c "import wiringpi; \'''
'''from wiringpi import GPIO; wiringpi.wiringPiSetup() ; \'''
'''wiringpi.pinMode(<span style="color:#FF0000">2, GPIO.OUTPUT</span>) ; "'''|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>Then set the GPIO port output low level. After setting, you can use the voltage of the voltage of the universal meter to measure the pins. If it is 0V, it means that the low -power flat is successful</li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~/wiringOP-Python# '''python3 -c "import wiringpi; \'''
'''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''
'''wiringpi.digitalWrite(<span style="color:#FF0000">2, GPIO.LOW</span>)"'''|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>Then set the GPIO port output high level. After setting, you can use the value of the voltage of the pins with a multimeter. If it is 3.3V, it means that the high -power flat is successful.</li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~/wiringOP-Python# '''python3 -c "import wiringpi; \'''
'''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''
'''wiringpi.digitalWrite(<span style="color:#FF0000">2, GPIO.HIGH</span>)"'''|}</ol></li></ol>
<ol start="3" style="list-style-type: decimal;">
<li><p>The steps of testing in the command line of Python3 are shown below: </p>
<ol style="list-style-type: lower-alpha;">
<li>First use the Python3 command to enter the command line mode of Python3</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~# '''python3'''
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>Then import the Python module of WiringPi</li></ol>{| class="wikitable" style="width:800px;" |-|
>>> '''import wiringpi'''
>>> '''from wiringpi import GPIO'''
|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>Then set the GPIO port as the output mode. The first parameter of the '''pinMode''' function is the serial number of the wpi corresponding to the pin, and the second parameter is the GPIO mode.</li></ol>{| class="wikitable" style="width:800px;" |-|
>>> '''wiringpi.wiringPiSetup()'''
0
>>> '''wiringpi.pinMode(<span style="color:#FF0000">2, GPIO.OUTPUT</span>)'''|}</ol>
<ol start="4" style="list-style-type: lower-alpha;">
<li>Then set the GPIO port output low level. After setting, you can use the value of the voltage of the pins with a multimeter. If it is 0V, it means that the low -power flat is set.</li></ol>{| class="wikitable" style="width:800px;" |-| >>> '''wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.LOW</span>)'''|}</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li>Then set the GPIO port output high level. After setting, you can use the value of the voltage of the pins with a multimeter. If it is 3.3V, it means that the high -power flat is successful</li></ol>{| class="wikitable" style="width:800px;" |-| >>> '''wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.HIGH</span>)'''|}</ol></li></ol>
<ol start="4" style="list-style-type: decimal;">
<li>Wiringop-Python Sets GPIO high and low levels in the Python code. For reference to the '''blink.py''' test program in Examples, the voltage of the '''blink.py''' test program will set up the voltage of all GPIO ports in the development board 40 PIN</li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~/wiringOP-Python# '''cd examples'''
root@orangepi:~/wiringOP-Python/examples'''# python3 blink.py'''
|}
</ol>
<span id="pin-spi-test-1"></span>
=== 40pin SPI test ===