We are trying to interface the memory IC(24C32) with the esp8266 using the esp8266basic. We have successfully interfaced it with the help of arduino but unsuccessful with esp8266basic
here is the code which I am working with
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
kindly let us know where we are going wrong.
Thanking you in anticipation.
Siddharth