2

I am trying out this tutorial here: http://www.instructables.com/id/Orange-Pi-One-Python-GPIO-basic/?ALLSTEPS

Whenever I execute my .py file, I get the error "cannot import name 'gpio'"

This here is the code I use after installing everything else, stated in the tut:

#import the library
from pyA20.gpio import gpio
from pyA20.gpio import port
from time import sleep

#initialize the gpio module
gpio.init()

#setup the port (same as raspberry pi's gpio.setup() function)
gpio.setcfg(port.PA7, gpio.OUTPUT)

#now we do something (light up the LED)
gpio.output(port.PA7, gpio.HIGH)

#turn off the LED after 2 seconds
sleep(2)
gpio.output(port.PA7, gpio.LOW)

I am pretty new to all of this, so please bear with me. Thank you very much.

payam_sbr
  • 1,428
  • 1
  • 15
  • 24
Fleder
  • 41
  • 4

1 Answers1

1

got same issue on orange pi Zero... I got the python library from https://pypi.python.org/pypi/pyA10Lime and it worked then :

root@orangepizero:~# wget https://pypi.python.org/packages/e6/52/a6b558fd5c8eb11e5de710271d59881769425e61d3adf6d235836ca877cc/pyA10Lime-0.2.1.tar.gz
root@orangepizero:~# tar -zxf pyA10Lime-0.2.1.tar.gz
root@orangepizero:~# cd pyA10Lime-0.2.1/
root@orangepizero:~/pyA10Lime-0.2.1#
root@orangepizero:~/pyA10Lime-0.2.1# vi setup.py
# 
# @line 60, add :
#             elif "sun8i" in processor:
#                 print ("Detected processor: " + print_color(processor) + " (Probably Allwinner H2+/H3)")
# 
root@orangepizero:~/pyA10Lime-0.2.1# python setup.py install
root@orangepizero:~/pyA10Lime-0.2.1# python
Python 2.7.9 (default, Aug 13 2016, 17:56:53)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyA20.gpio import gpio
>>> from pyA20.gpio import port
>>> gpio.init()
>>> gpio.setcfg(port.PG7, gpio.OUTPUT)
>>> gpio.output(port.PG7, gpio.HIGH)
>>>
>>> gpio.output(port.PG7, gpio.LOW)
>>> exit()

usefull link https://forum.armbian.com/index.php?/topic/3655-guide-orange-pi-zero-gpios/

GilZm
  • 21
  • 5