We are flooded with GPIO information from RaspberryPi. Then we learned that OrangePi GPIO pin layout is compatible with RaspberryPi, but with some subtle difference in naming convention. If you are RaspberryPi fans, you will find it more difficult to use OrangePi GPIO, not only the naming is different, but you have to use another set of library calls. Also, the pin layout is upside down.
This is how I setup GPIO in Python 3.
First, prepare the Python environment,
$ sudo apt-get install python3-setuptools
$ sudo apt-get install python3-dev
Then, install the pyA20 library,
$ sudo pip3 install pyA20
Now install the library to manage the Orange Pi GPIO.
$ cd
$ git clone https://github.com/duxingkei33/orangepi_PC-gpio_pyH3
$ cd orangepi_PC_gpio_pyH3
$ sudo python3 setup.py install
Here is the test program to turn LED ON/OFF every second,
#!/usr/bin/env python3
# Turn LED On/Off with PA
# Kevin Lee 31 Dec 2019
# Connect LED to OpiZ pin 25 (GND) & 26 (PA10)
from pyA20.gpio import gpio
from pyA20.gpio import port
from time import sleep
gpio.init()
gpio.setcfg(port.PA10, gpio.OUTPUT)
while True:
gpio.output(port.PA10, gpio.HIGH)
print('ON')
sleep(1)
gpio.output(port.PA10, gpio.LOW)
print('OFF')
sleep(1)
This is the pinout of Orange Zero Pi,
Lee Sir,
31 December 2019
Hong Kong.
Reference:
Orange Pi One/Lite (Tutorial): use the GPIO in Python, pinouts, 15 January 2017, https://diyprojects.io/orange-pi-onelite-tutorial-use-gpio-python-pinouts/#.XgsDjvwRXIV
Update 28 March 2020:
Sad to say this library only works for 32bit sunxi processors, 64 bits SoCs like OrangePi Lite 2, are not supported.
This is how I setup GPIO in Python 3.
First, prepare the Python environment,
$ sudo apt-get install python3-setuptools
$ sudo apt-get install python3-dev
Then, install the pyA20 library,
$ sudo pip3 install pyA20
Now install the library to manage the Orange Pi GPIO.
$ cd
$ git clone https://github.com/duxingkei33/orangepi_PC-gpio_pyH3
$ cd orangepi_PC_gpio_pyH3
$ sudo python3 setup.py install
Here is the test program to turn LED ON/OFF every second,
#!/usr/bin/env python3
# Turn LED On/Off with PA
# Kevin Lee 31 Dec 2019
# Connect LED to OpiZ pin 25 (GND) & 26 (PA10)
from pyA20.gpio import gpio
from pyA20.gpio import port
from time import sleep
gpio.init()
gpio.setcfg(port.PA10, gpio.OUTPUT)
while True:
gpio.output(port.PA10, gpio.HIGH)
print('ON')
sleep(1)
gpio.output(port.PA10, gpio.LOW)
print('OFF')
sleep(1)
This is the pinout of Orange Zero Pi,
Lee Sir,
31 December 2019
Hong Kong.
Reference:
Orange Pi One/Lite (Tutorial): use the GPIO in Python, pinouts, 15 January 2017, https://diyprojects.io/orange-pi-onelite-tutorial-use-gpio-python-pinouts/#.XgsDjvwRXIV
Update 28 March 2020:
Sad to say this library only works for 32bit sunxi processors, 64 bits SoCs like OrangePi Lite 2, are not supported.
Comments
Post a Comment