Error Working with ADS1015 and Raspbian

Talk about Adafruit Raspberry Pi® accessories!

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

Postby MattRichardson » Sun Dec 02, 2012 1: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
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
MattRichardson
 
Posts: 4
Joined: Tue Sep 28, 2010 2:13 pm

Return to Adafruit Raspberry Pi® accessories

Who is online

Users browsing this forum: No registered users and 2 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [108]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[31]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[34]
LCDs & Displays[48]
Components & Parts[70]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[111]
 
Wireless[14]
Cables[62]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]