Memorial day is 05/25/2015 – Orders will ship out on May 26th. There will not be any deliveries or shipping on Monday. Any order placed after 11am ET on Friday May 22nd will not start to ship out until Tuesday May 26th.

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/

Error Working with ADS1015 and Raspbian

by mattrichardson on Sun Dec 02, 2012 2:52 pm

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 | TOGGLE FULL SIZE
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 | TOGGLE FULL SIZE
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
mattrichardson
 
Posts: 4
Joined: Tue Sep 28, 2010 3:13 pm



cron