PINE64

Full Version: RPi.GPIO python module for Pine A64/A64+
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10
(02-18-2017, 06:49 AM)JasperBrown Wrote: [ -> ]- pip(ed) the Rasp.Pi GPIO

Whit the above line, you seem to try to compile RaspberryPi version, not the A64.
no one has mentioned the script,
create_gpio_user_permissions.py
is there some criteria by which this script should [or should not] be run?
it seems like maybe it should be run but maybe it is called from another install script? thanks.
(02-18-2017, 12:16 PM)martinayotte Wrote: [ -> ]Whit the above line, you seem to try to compile RaspberryPi version, not the A64.


After
Code:
sudo python setup.py install
had not worked..i tried the install.txt from git..

You just had ran the setup.py and it worked?
After getting the git, yes, only "python setup.py install" is required.
Which system image did you use?
(02-21-2017, 04:43 AM)JasperBrown Wrote: [ -> ]Which system image did you use?

If you meet us on irc chat we can help you in real time;  often its faster with less confusion.

Big Grin

see below for chat room details
(02-21-2017, 04:43 AM)JasperBrown Wrote: [ -> ]Which system image did you use?

Armbian Mainline 4.10, but months ago, I was using longsleep and it was working there too.
Has anybody used this library for I2C?

I got my first I2C device recently, this temp/pressure sensor. I tried reading it from an ESP8266 and an arduino first and didn't have any luck, so I decided to give it a try on the pine64. It shows up on i2cdetect, and if I run "sudo i2cdump twi1 0x76" it dumps a bunch of data, so I'm guessing it's wired up right.

I saw in the notes in github that this library has I2C "borrowed from pyA20", so a little googling found me some documentation here (you have to scroll a bit to get to the I2C info).

From that info, I put together this python script:
Code:
#!/usr/bin/env python3
from RPi import I2C

I2C.init("/dev/twi1")
I2C.open(0x76)

# set power mode to forced
I2C.write([0xF4,0x01])
sleep(1)

# dump data
I2C.write([0xF7])
value = I2C.read(1)
print(value)

I2C.close()
quit()

Now when I run this (as root) using python3, I get this error:
Code:
Traceback (most recent call last):
 File "./bmp280_readonce.py", line 2, in <module>
   from RPi import I2C
 File "/usr/lib64/python3.4/site-packages/RPi/I2C/__init__.py", line 4, in <module>
   from RPi._I2C import *
ImportError: dynamic module does not define init function (PyInit__I2C)

I tried changing the first line to use python2 instead of python3, and then I get this error instead:
Code:
Traceback (most recent call last):
 File "./bmp280_readonce.py", line 5, in <module>
   I2C.open(0x76)
IOError: [Errno 2] No such file or directory

Any idea what I'm doing wrong?
Are you using the library from https://github.com/swkim01/RPi.GPIO-PineA64 ?
I've verified it with both python2.7 and python 3.5 under Armbian, and it is working with both.
Yes, that's the one. So far I've just used it to blink LED's. This is my first attempt at trying to work with I2C. I wonder if there's some sample code that I could look at somewhere.
Pages: 1 2 3 4 5 6 7 8 9 10