1

I want to add a TSL2561 to an existing (Model B, Wheezy) system that is built on Python 2.7, and uses some other GPIOs (not using I2C), with the module rpi.GPIO.

The TSL2561 python library has a dependency on Adafruit_GPIO.
This article says Adafruit_GPIO is a "wrapper for original RPi.GPIO library as well as the Beaglebone's"

tsl2561.py imports Adafruit_GPIO, but does not use GPIO, only I2C.

Is it possible to separately import the required I2C module for the TSL2561 , without breaking existing code that uses rpi.gpio? If so, which I2C module would match the conventions of tsl2561.py?

  • Why is the system so out of date? Wheezy is not one but two major versions back (presumably Raspbian but you do not say) from the current state of play and this may make it harder to get useful responses. Even then although it sounds as though you might be looking for hints on hacking software it is really not that clear what you are asking for, I think more details will be needed... – SlySven Dec 25 '18 at 12:54
1

The dependency on GPIO is an artifact of the TSL2561 python library referenced above. The one I was trying to use has the dependency on Adafruit_GPIO, which introduces complications when also using rpi.gpio.

However, with more searching I found this TSL2561 python code in ControlEverythingCommunity that only imports smbus. As correctly noted by @joan, there is no need to tie I2C to GPIO, except that the Adafruit_GPIO library apparently does.

The example provided by ryker1990 in update TSL2561.py works.

0

I don't really understand the question.

There is no need to use RPi.GPIO if you want to use an I2C device.

The standard Python I2C module is smbus. That is the module you need to import if you want to interface to an I2C device.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.