Please select To the mobile version | Continue to access the desktop computer version

OrangePi

 Login            
 Register            
Search
Hot search: orangepi
12Next
Return to list New
View: 22602|Reply: 14

PYTHON lib for OrangePi -PC GIPO is out

[Copy link]

18

Threads

303

Posts

7792

Credits

Moderator

Rank: 7Rank: 7Rank: 7

Credits
7792
Post time 2015-10-11 23:17:11 | Show all posts |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
Post time 2015-10-14 20:16:06 | Show all posts
Have you tried it?

18

Threads

303

Posts

7792

Credits

Moderator

Rank: 7Rank: 7Rank: 7

Credits
7792
 Author| Post time 2015-10-17 19:53:27 | Show all posts
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
Post time 2015-10-28 23:50:48 | Show all posts
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

7792

Credits

Moderator

Rank: 7Rank: 7Rank: 7

Credits
7792
 Author| Post time 2015-10-30 11:46:36 | Show all posts
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
Post time 2015-11-1 08:02:33 | Show all posts
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

7792

Credits

Moderator

Rank: 7Rank: 7Rank: 7

Credits
7792
 Author| Post time 2015-11-1 16:48:07 | Show all posts
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
Post time 2015-11-2 07:29:43 | Show all posts
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

7792

Credits

Moderator

Rank: 7Rank: 7Rank: 7

Credits
7792
 Author| Post time 2016-3-10 21:27:52 | Show all posts
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
Post time 2016-3-16 16:43:22 | Show all posts
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 the Code
12Next
Return to list New
You have to log in before you can reply Login | Register

Points Rules

Archiver|Mobile edition|Darkroom|OrangePi En ( 粤ICP备14086627号-2

2020-1-17 21:45 GMT+8 , Processed in 0.035616 second(s), 22 queries .

Powered by Discuz! X3.2

© 2014-2015 orangepibbs en.

Quick Reply To Top Return to the list