Orange Pi One Python GPIO (basic) – All

树莓派 徐 自远 1608℃

Here’s how to get GPIO working in Python on the Orange Pi One.Note. The GPIO pins on the Orange Pi One are flipped 180 degrees compared to the Orange Pi PC version or a Raspberry Pi!check out my other Orange Pi tutorials:http://www.instructables.com/id/Orange-Pi-One-Setup-Guide/http://www.instructables.com/id/Orange-Pi-One-Analog-Devices-Using-MCP3008-Via-SPI/

来源: Orange Pi One Python GPIO (basic) – Allorange 

说明:是基于python2.7的库。基本思路差不多的。

Here’s how to get GPIO working in Python on the Orange Pi One.

Note. The GPIO pins on the Orange Pi One are flipped 180 degrees compared to the Orange Pi PC version or a Raspberry Pi!

check out my other Orange Pi tutorials:

http://www.instructables.com/id/Orange-Pi-One-Setup-Guide/

http://www.instructables.com/id/Orange-Pi-One-Analog-Devices-Using-MCP3008-Via-SPI/

Step 1: Download and install python library

To start you will need the python headers and library installed, if you haven’t or aren’t sure just type:

Then download the pyH3 library from:

https://github.com/duxingkei33/orangepi_PC_gpio_pyH3

extract the folder and place in ‘/home/pi’

from the terminal go into that directory:

then install it using:

The library is now installed.

Step 2: Test It!

Test It!

The way the pins are referred to are slightly different to a Raspberry Pi, they are named “ports” & “connectors”.

UPDATE 03/05/2016: The new armbian images no longer export the gpios to /gpio_sw. See the above image for the port names. Image Credit: http://forum.armbian.com/index.php/topic/759-tutor…

For example pin 29 (BCM05) is port ‘PA7’

To test, connect an LED to pin 29 through a 300ohm resistor then to the ground. (see diagram below)

and created a file called ‘test.py’:

Dont forget to make your test file executable:

and run as root:

Step 3: .

.

That’s the basics working, more advanced stuff like i2C should work aswell but I haven’t tested.

Credit goes to: Duxingkei Chow and Stefan Mavrodiev (examples in git repository)

转载请注明:徐自远的乱七八糟小站 » Orange Pi One Python GPIO (basic) – All

喜欢 (0)

苏ICP备18041234号-1 bei_an 苏公网安备 32021402001397号