User Manual Orange Pi Zero 3

  Features   |  Use   |    Linux     |  Linux SDK   |  Android   |  Android SRC   |

RU          EN  

Chapt 3. Instructions for use of Debian/Ubuntu Server and Xfce desktop system
Страница:   25    26    27    28    29    30    31    32    33    34    35    36    37    38    39    40    41    42    43    44    45    46    47    48    49    50    51    52    53    54    55    56    57    58    59    60    61    62    63    64    65    66    67    68    69    70    71    72    73    74    75    76    77    78    79    80    81    82    83    84    85    86    87    88    89    90    91    92    93    94    95    96    97    98    99    100    101    102    103    104    105    106    107    108    109    110    111    112    113    114    115    116    117    118    119    120    121    122  


3.19.2. 26pin GPIO port test
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.


Img 3.143

  • 1) The following takes pin 7 —the corresponding GPIO is PC9 —the corresponding wPi number is 2 — as an example to demonstrate how to set the high and low levels of the GPIO port


    Img 3.144

  • 2) The steps to test directly with the command are as follows:

    a. First set the GPIO port to output mode, where 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

    root@orangepi:~/wiringOP-Python# python3 -c "import wiringpi; \
    from wiringpi import GPIO; wiringpi.wiringPiSetup() ; \
    wiringpi.pinMode(2, GPIO.OUTPUT) ; "

    b. Then set the GPIO port to output low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 0v, it means that the low level is set successfully.

    root@orangepi:~/wiringOP-Python# python3 -c "import wiringpi; \
    from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\
    wiringpi.digitalWrite(2, GPIO.LOW)"

    c. Then set the GPIO port to output a high level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 3.3v, it means that the high level is set successfully.

    root@orangepi:~/wiringOP-Python# python3 -c "import wiringpi; \
    from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\
    wiringpi.digitalWrite(2, GPIO.HIGH)"

  • 3) The steps to test in the command line of python3 are as follows:

    a. First use the python3 command to enter the command line mode of python3

    root@orangepi:~# python3

    b. Then import the python module of wiringpi

    >>> import wiringpi
    >>> from wiringpi import GPIO

    c. Then set the GPIO port to output mode, where 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

    >>> wiringpi.wiringPiSetup()
    >>> wiringpi.pinMode(2, GPIO.OUTPUT)

    d. Then set the GPIO port to output low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 0v, it means that the low level is set successfully.

    >>> wiringpi.digitalWrite(2, GPIO.LOW)

    e. Then set the GPIO port to output a high level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 3.3v, it means that the high level is set successfully.

    >>> wiringpi.digitalWrite(2, GPIO.HIGH)

  • 4) 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.

    root@orangepi:~/wiringOP-Python# cd examples
    root@orangepi:~/wiringOP-Python/examples# ls blink.py
    blink.py
    root@orangepi:~/wiringOP-Python/examples# python3 blink.py

     <         > 


  • Страница:   25    26    27    28    29    30    31    32    33    34    35    36    37    38    39    40    41    42    43    44    45    46    47    48    49    50    51    52    53    54    55    56    57    58    59    60    61    62    63    64    65    66    67    68    69    70    71    72    73    74    75    76    77    78    79    80    81    82    83    84    85    86    87    88    89    90    91    92    93    94    95    96    97    98    99    100    101    102    103    104    105    106    107    108    109    110    111    112    113    114    115    116    117    118    119    120    121    122