tdicola / Adafruit_Trellis_Python

Python library for using the Adafruit Trellis on a Beaglebone Black or Raspberry Pi.
MIT License
14 stars 10 forks source link

Adafruit_I2C.py no longer available #2

Open nyboer opened 8 years ago

nyboer commented 8 years ago

The instruction

On the Raspberry Pi, download the Adafruit Raspberry Pi Python code and copy the Adafruit_I2C.py file to the directory of your Trellis project. can't be completed, since the Pi Python code repo more or less redirects to https://github.com/adafruit/Adafruit_Python_GPIO/I2C.py which won't be found.

Perhaps it should be import I2C as Adafruit_I2C then install?

I hope it is so simple.

DTV96Calibre commented 7 years ago

Any update on this?

Vilhjalmr26 commented 7 years ago

in line 19 you need to replace import Adafruit_I2C with import Adafruit_GPIO.I2C as I2C and in the begin function line 57 replace self._i2c = Adafruit_I2C.Adafruit_I2C(addr, bus) with self._i2c = I2C.Device(addr, bus)

also, if you are using python 3, on line 234 in the _get_matrix function, you need to replace matrix = position / 16 with matrix = position // 16 then run the python setup.py install command again to install the updated file.
This will allow the code to run using the new libraries, installed via sudo apt-get update sudo apt-get install -y python3 python3-pip python-dev sudo pip3 install rpi.gpio per https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code