Python GPIOs module for A20-OLinuXino-MICRO


Image

pyA20 GPIO module is uploaded yesterday to Pypi https://pypi.python.org/pypi/pyA20/0.1.0

The use is same as the Python modules for imx233, A10S, A13 OLinuXino:

#!/usr/bin/env python
import A20_GPIO as GPIO
#init module
GPIO.init()
#configure module
GPIO.setcfg(GPIO.PIN#, GPIO.OUTPUT)
GPIO.setcfg(GPIO.PIN#, GPIO.INPUT)
#read the current GPIO configuration
config = GPIO.getcfg(GPIO.PIN#)
#set GPIO high
GPIO.output(GPIO.PIN#, GPIO.HIGH)
#set GPIO low
GPIO.output(GPIO.PIN#, GPIO.LOW)
#read input
state = GPIO.input(GPIO.PIN#)
#cleanup
GPIO.cleanup()

this is initial release so if you find some bugs please report back to us🙂

3 Comments (+add yours?)

  1. mauricio
    Sep 11, 2013 @ 04:18:55

    hello, using 0.1.3 release

    I tried to run a blink script, but receive this error message

    Traceback (most recent call last):
    File “./test.py”, line 35, in
    main()
    File “./test.py”, line 13, in main
    GPIO.setcfg(GPIO.PIN37, GPIO.OUT)
    AttributeError: ‘module’ object has no attribute ‘PIN37’

    any advice ?

    thanks in advance

    Reply

  2. Lub/OLIMEX
    Sep 11, 2013 @ 09:19:53

    Hello Mauricio,

    The read me is a bit outdated. If you look at the code you will see that LED2 is named “GPIO.PIN_PH2”, for instance.

    Replace GPIO.PIN37 with GPIO.PIN_PH2.

    Regards,
    Lub/OLIMEX

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: