WiringOP for Orange pi zero 看全部

quote: gailu replied at 2017-2-17 21:31
Got the difference between OPI PC and OPI Zero mapping. Its working fine now.

Any chance you would share that info? I'm having the same issue.

Edited by sb17joker at 2017-2-25 17:38

ok, figured out most of it, and updated readall.c, pins 19, and 21 still haven't figured out... but...


attachment: 您需要登录才可以下载或查看附件。没有账号?Register
  • 13# diyer
  • 2017-3-6 06:03:03
can someone explain how to map wiringPO on zero plaese?
Edited by nopnop2002 at 2017-3-15 11:24
quote: diyer replied at 2017-3-6 06:03
can someone explain how to map wiringPO on zero plaese?

Please use WiringOP-ZERO

https://github.com/xpertsavenue/WiringOP-Zero

It have compatibility of the pin number.
But if you operate GPIO using device file,ZERO don't have compatibility to OPI-PC.

You can know this difference in [gpio readall] command.

Operate Pin#18 with OPI-PC

$ sudo sh -c "echo 71 >/sys/class/gpio/export"
$ sudo sh -c "echo out >/sys/class/gpio/gpio71/direction"
$ sudo sh -c "echo 1 > /sys/class/gpio/gpio71/value"
$ sudo sh -c "echo 0 > /sys/class/gpio/gpio71/value"
$ sudo sh -c "echo 71 > /sys/class/gpio/unexport"


Operate Pin#18 with ZERO


$ sudo sh -c "echo 18 >/sys/class/gpio/export"
$ sudo sh -c "echo out >/sys/class/gpio/gpio18/direction"
$ sudo sh -c "echo 1 > /sys/class/gpio/gpio18/value"
$ sudo sh -c "echo 0 > /sys/class/gpio/gpio18/value"
$ sudo sh -c "echo 18 > /sys/class/gpio/unexport"







Edited by nopnop2002 at 2017-3-15 11:50
quote: diyer replied at 2017-3-6 06:03
can someone explain how to map wiringPO on zero plaese?

In case of Python, you can use there library.

orangepi_PC_gpio_pyH3
https://github.com/duxingkei33/orangepi_PC_gpio_pyH3

WiringPi-Python-OP
https://github.com/lanefu/WiringPi-Python-OP

But there library pin assin is not same.

In case orangepi_PC_gpio_pyH3.
PysPin PinInLib
1(3.3V)
2(5V)
3      12
4(5V)
5      11
6(GND)
7      6
8      198
9(GND)
10     199
11     1
12     7
13     0
14(GND)
15     3
16     19
17(3.3V)
18     18
19     15
20(GND)
21     16
22     2
23     14
24     13
25(GND)
26     10

  1. # -*- coding: utf-8 -*-
  2. from pyA20.gpio import gpio
  3. from pyA20.gpio import port
  4. import time
  5. import sys

  6. PIN = port.PA10

  7. argvs = sys.argv
  8. argc = len(argvs)

  9. if (argc == 2):
  10.   PIN = int(argvs[1])

  11. print "PIN=",PIN
  12. gpio.init()
  13. gpio.setcfg(PIN, gpio.OUTPUT)

  14. for _ in xrange(5):
  15.     gpio.output(PIN,True)
  16.     time.sleep(1.0)
  17.     gpio.output(PIN,False)
  18.     time.sleep(1.0)


In case WiringPi-Python-OP.
PysPin PinInLib
1(3.3V)
2(5V)
3      8
4(5V)
5      9
6(GND)
7      7
8      28
9(GND)
10     29
11     0
12     21
13     2
14(GND)
15     3
16     30
17(3.3V)
18     31
19     Can't USE
20(GND)
21     Can't USE
22     6
23     16
24     15
25(GND)
26     24

  1. # -*- coding: utf-8 -*-
  2. import wiringpi
  3. import time
  4. import sys

  5. OUTPUT = 1
  6. HIGH = 1
  7. LOW = 0
  8. PIN = 15

  9. argvs = sys.argv
  10. argc = len(argvs)

  11. if (argc == 2):
  12.   PIN = int(argvs[1])

  13. print "PIN=",PIN
  14. wiringpi.wiringPiSetup()
  15. wiringpi.pinMode(PIN,OUTPUT)
  16. wiringpi.digitalWrite(PIN,LOW)
  17. for _ in xrange(5):
  18.   wiringpi.digitalWrite(PIN,HIGH)
  19.   time.sleep(1)
  20.   wiringpi.digitalWrite(PIN,LOW)
  21.   time.sleep(1)

1234.. 7NextPage