|
Edited by nopnop2002 at 2016-3-26 10:47
Try orangepi_PC_gpio_pyH3.
- $ sudo apt-get install python-dev git make gcc
- $ git clone https://github.com/duxingkei33/orangepi_PC_gpio_pyH3.git
- $ cd orangepi_PC_gpio_pyH3
- $ sudo python setup.py install
Copy code
The example which turns on/off GPIO4.
Raspberry pi.
- # -*- coding: utf-8 -*-
- import RPi.GPIO as GPIO
- import time
- COUNT = 3
- PIN = 4
- #GPIO.setmode(GPIO.BOARD)
- GPIO.setmode(GPIO.BCM)
- GPIO.setup(PIN,GPIO.OUT)
- for _ in xrange(COUNT):
- GPIO.output(PIN,True)
- time.sleep(1.0)
- GPIO.output(PIN,False)
- time.sleep(1.0)
- GPIO.cleanup()
Copy code OrangePi
- # -*- coding: utf-8 -*-
- from pyA20.gpio import gpio
- from pyA20.gpio import port
- import time
- COUNT = 3
- PIN = port.PA6
- gpio.init()
- gpio.setcfg(PIN, gpio.OUTPUT)
- for _ in xrange(COUNT):
- gpio.output(PIN,True)
- time.sleep(1.0)
- gpio.output(PIN,False)
- time.sleep(1.0)
- #gpio.cleanup()
Copy code
You have to change the cord only a little.
|
|