ESP8266 with 24C32 memory IC + esp8266basic
Posted: Fri Jan 06, 2017 7:58 am
Hi,
I am working on ESP8266 basic and want to implemenation I2C functionality
the I2C chip I am using is 24c32
We have written a code which is able to scan the device address but I am unable to read and wrtie to the device.
Kindly help us with the same
Thanks and regards.
SIddharth
I am working on ESP8266 basic and want to implemenation I2C functionality
the I2C chip I am using is 24c32
We have written a code which is able to scan the device address but I am unable to read and wrtie to the device.
Kindly help us with the same
Code: Select all
cls
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
wprint "Found I2C device at address: 0x" & hex(address)
wprint " - > " & address
wprint " <br>"
got_address = address
endif
next
wait
[I2C_Write]
i2c.begin(got_address)
i2c.write(0)
delay 5
i2c.write(150)
i2c.end()
wprint "write complete"
wait
[I2C_read]
i2c.begin(got_address)
i2c.write(0)
i2c.end()
i2c.begin(got_address)
i2c.requestfrom(got_address,1)
delay 5
i2c_read = i2c.read()
i2c.end()
print i2c_read
wprint "read complete"
wait
Thanks and regards.
SIddharth