We want to interface t5he 24c32 i2c eeprom IC with the esp85266 and using esp8266basic. We have tested the hardware with arduino and it works fine. Now we are trying to interface it with the esp8266 but only the I2C find function works. We are not sure whether the writing or the reading is happening properly or not. Kindly shed some light of the issue. I preset here with the code
cls
let eeprom_address = 0
button "i2c Find" [I2C_find]
button "i2c Read" [I2C_read]
button "i2c Write" [I2C_Write]
wait
[I2C_find]
for address = 1 to 127
i2c.begin(address)
stat = i2c.end()
if stat < 1 then
' print stat
print "Found I2C device at address: 0x" & hex(address)
print " - > " & address
print " <br>"
got_address = address
endif
next
wait
[I2C_Write]
print "writing to address " & got_address
i2c.begin(got_address)
i2c.write(eeprom_address >> 8)
i2c.write(eeprom_address)
i2c.write("A")
i2c.end()
print "write complete"
wait
[I2C_read]
print "reading from address " & got_address
i2c.begin(got_address)
i2c.write(eeprom_address >> 8)
i2c.write(eeprom_address)
i2c.end()
i2c.requestfrom(got_address,1)
if i2c.available() then
i2c_read = i2c.read()
i2c.end()
print "the data is " & i2c_read
end if
print "read complete"
wait
please help
regards.
Siddhath