Krafter
Posts: 22
Joined: Wed Jan 27, 2016 11:36 pm

Raspberry Pi and 24LC256

Sat Jul 09, 2016 8:11 pm

Just starting in on the i2c protocol and all ready having issues. My goal in the end is to use a PICAXE as a ADC for a project I'm working on but thought I'd start with using an EEPROM chip 24LC256 just as an intro to i2c. I'm referring to this topic (post #14) on the PICAXE forums but when I read back the data, all I get is a value of 255. I've even changed line 8 from "data = loc + 65" to "data = 1". I still read back a value of 255. What am I missing here?

Code: Select all

from smbus import SMBus
import time

bus = SMBus(1)       #for pi rev 2
adr = 0x50

for loc in range 5:
    data = loc + 65
    bus.write_byte_data(adr,loc,data)
    time.sleep(.01)
    ch = bus.read_byte_data(adr,loc)
    print ch

Return to “General discussion”