Error Working with ADS1015 and Raspbian

Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Locked
User avatar
mattrichardson
 
Posts: 8
Joined: Tue Sep 28, 2010 3:13 pm

Error Working with ADS1015 and Raspbian

Post by mattrichardson »

Hello,

I'm trying to get the ADS1015 breakout working with Raspbian. I have i2c working, and it can detect the ADS1015:

Code: Select all

pi@raspberrypi ~/analog/Adafruit-Raspberry-Pi-Python-Code/Adafruit_ADS1x15 $ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
But when I try to run the example code, I get this error:

Code: Select all

pi@raspberrypi ~/analog/Adafruit-Raspberry-Pi-Python-Code/Adafruit_ADS1x15 $ sudo python ads1015_example.py 
Error accessing 0x48: Check your I2C address
Error accessing 09x48: Check your I2C address
Traceback (most recent call last):
  File "ads1015_example.py", line 13, in <module>
    result = adc.readADCSingleEnded(0)
  File "/home/pi/analog/Adafruit-Raspberry-Pi-Python-Code/Adafruit_ADS1x15/Adafruit_ADS1x15.py", line 135, in readADCSingleEnded
    return ( ((result[0] << 8) | (result[1] & 0xFF)) >> 4 )
TypeError: 'int' object has no attribute '__getitem__'
I have been looking through the code in the Adafruit I2C base class to determine how to fix the problem, but I'm not 100% sure how to trace it. Does anyone have any leads?

Thanks,
Matt

Locked
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/

Return to “Adafruit Raspberry Pi® accessories”