please choosego to mobile | Continue to access the PC version
View: 35031|Reply: 14

PYTHON lib for OrangePi -PC GIPO is out

[Copy link]

18

threads

303

posts

9846

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
9846
Published in 2015-10-11 23:17:11 | Show all floors |Read mode
Edited by jacer at 2015-10-30 11:45

PYTHON lib for OrangePi -PC GIPO is out. Check here for testing.


https://github.com/duxingkei33/orangepi_PC_gpio_pyH3

or this below.
http://www.orangepi.org/orangepibbsen/forum.php?mod=redirect&goto=findpost&ptid=148&pid=4297&fromuid=37174

Two versions from two authors.

Now there is a third version, check the link below.
WiringPO

6

threads

73

posts

266

credits

Intermediate member

Rank: 3Rank: 3

credits
266
Published in 2015-10-14 20:16:06 | Show all floors
Have you tried it?

18

threads

303

posts

9846

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
9846
 Author| Published in 2015-10-17 19:53:27 | Show all floors
Edited by jacer at 2015-10-17 20:13

Yes, it works. You can also try this below.
http://www.orangepi.org/orangepibbsen/forum.php?mod=redirect&goto=findpost&ptid=148&pid=4297&fromuid=37174

0

threads

1

posts

312

credits

Intermediate member

Rank: 3Rank: 3

credits
312
Published in 2015-10-28 23:50:48 | Show all floors
Edited by aaapee at 2015-10-29 11:51

Hello
Trying to make my pir sensors work. How can i read gpio rising ? Connector gpio1p11 is this pin number 11.
Thanks



#!/usr/bin/python

# Import required Python libraries
import os
import sys
import time

if not os.getegid() == 0:
    sys.exit('Script must be run as root')

from time import sleep
from pyA20.gpio import gpio
from pyA20.gpio import connector
from pyA20.gpio import port

#led = connector.gpio1p38    # This is the same as port.PH2
#button = connector.gpio1p17  #CHOW
PIR_PIN = connector.gpio1p11

"""Init gpio module"""
gpio.init()

"""Set directions"""
#gpio.setcfg(led, gpio.OUTPUT)
#gpio.setcfg(button, gpio.INPUT)
#gpio.pullup(button, gpio.PULLUP)
#gpio.pullup(button, gpio.PULLDOWN)
gpio.setcfg(PIR_PIN, gpio.INPUT)

# Set pin as input
#gpio.setup(button,gpio.INPUT)      # Echo

def MOTION(PIR_PIN):
    print "Motion Detected"

print "PIR Module Test (CTRL+C to exit)"
time.sleep(1)
print "Ready"

try:
     state = gpio.input(PIR_PIN)
     gpio.add_event_detect(PIR_PIN, GPIO.RISING, callback=MOTION)
     while 1:
     time.sleep(100)

except KeyboardInterrupt:
  print "Quit"


18

threads

303

posts

9846

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
9846
 Author| Published in 2015-10-30 11:46:36 | Show all floors
aaapee replied at 2015-10-28 23:50
Hello
Trying to make my pir sensors work. How can i read gpio rising ? Connector gpio1p11 is this pi ...

You can try the third version. Just click the link below.
Click Here!

0

threads

3

posts

66

credits

Registered member

Rank: 2

credits
66
Published in 2015-11-1 08:02:33 | Show all floors
I tried  orangepi_PC_gpio_pyH3 for python and I have problem with pin port.POWER_LED it should be green led on the board but it doesn't shine.
When I tried port.STATUS_LED, it is red led on the board, it working.

Found someone where is the mistake in the library?

p.s. Green led on the board is ok, because it is working when I use shell command.

18

threads

303

posts

9846

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
9846
 Author| Published in 2015-11-1 16:48:07 | Show all floors
mato157 replied at 2015-11-1 08:02
I tried  orangepi_PC_gpio_pyH3 for python and I have problem with pin port.POWER_LED it should be gr ...

Try the third version posted above you.

0

threads

3

posts

66

credits

Registered member

Rank: 2

credits
66
Published in 2015-11-2 07:29:43 | Show all floors
jacer replied at 2015-11-1 16:48
Try the third version posted above you.

But wiringOP is library for C, and I can something for python.
Or is there a way how can use wiringOP for python?

18

threads

303

posts

9846

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
9846
 Author| Published in 2016-3-10 21:27:52 | Show all floors
mato157 replied at 2015-11-2 07:29
But wiringOP is library for C, and I can something for python.
Or is there a way how can use wirin ...

Check this below.

https://github.com/duxingkei33/orangepi_PC_gpio_pyH3

0

threads

1

posts

30

credits

Novice

Rank: 1

credits
30
Published in 2016-3-16 16:43:22 | Show all floors
hi, what I did wrong? I have orange pi pc
  1. oot@OrangePI:~/pyA20-0.2.1# python setup.py install

  2. running install
  3. running build
  4. running build_py
  5. creating build
  6. creating build/lib.linux-armv7l-2.7
  7. creating build/lib.linux-armv7l-2.7/pyA20
  8. copying pyA20/__init__.py -> build/lib.linux-armv7l-2.7/pyA20
  9. creating build/lib.linux-armv7l-2.7/pyA20/gpio
  10. copying pyA20/gpio/__init__.py -> build/lib.linux-armv7l-2.7/pyA20/gpio
  11. running build_ext
  12. Detected processor: unknown
  13. Warning! Detected and target processor mismatch.
  14. Do you want to continue [Y/n]? Abort.
  15. root@OrangePI:~/pyA20-0.2.1# cpuid
  16. -bash: cpuid: command not found
  17. root@OrangePI:~/pyA20-0.2.1#
  18. root@OrangePI:~/pyA20-0.2.1# less /proc/cpuinfo
  19. Processor       : ARMv7 Processor rev 5 (v7l)
  20. processor       : 0
  21. BogoMIPS        : 1920.00

  22. processor       : 1
  23. BogoMIPS        : 1920.00

  24. processor       : 2
  25. BogoMIPS        : 1920.00

  26. processor       : 3
  27. BogoMIPS        : 1920.00

  28. Features        : swp half thumb fastmult vfp edsp thumbee neon vfpv3 tl
  29. s vfpv4 idiva idivt
  30. CPU implementer : 0x41
  31. CPU architecture: 7
  32. CPU variant     : 0x0
  33. CPU part        : 0xc07
  34. CPU revision    : 5

  35. Hardware        : sun8i
  36. Revision        : 0000
  37. Serial          : 34005034431420320c8e
Copy code
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list