I am trying to write and read data from I2C based EEPROM. When i try the same code from the serial terminal it runs fine and it dont give me error.
But when i try to execute same code from main.py file i get the following OS Error "OSError: [Errno 5] EIO" .
Below i have given my code.
Code: Select all
from pyb import I2C, Pin
#I2C Initialisation
i2c = I2C(1,I2C.MASTER, baudrate = 100000)
#Write data "A" to slave address 80
i2c.mem_write("A",80,1,timeout = 5000, addr_size = 8)
#Recieve data into Recieve Buffer
i2c.mem_read(1, 80, 1, timeout = 5000, addr_size = 8)