9 years, 9 months ago.

How to read multiple bytes of data from EEPROM?Here I am showing my code m getting error with this

  1. include "mbed.h"
  2. include "_24LCXXX.h" Serial bunny(USBTX,USBRX);

I2C i2c(p28, p27); SDA, SCL

int main() { i2c.frequency(100000); We do fast speed void frequency(int hz); bunny.baud(9600); int ret; char data[2]; char data[20]="Hello world";

I2C *sam= new I2C(p28, p27); _24LCXXX obj(sam,0x50); int i; for(i=70;i<90;i++) { ret= obj.nbyte_read(i, data,2 ); ret = obj.nbyte_write(i,data,20); if(ret==0) { bunny.printf("read no of bytes: %d is %s \n",ret,data); bunny.printf("write no of bytes: %d is %s \n",ret,data); } else { bunny.printf(" write-FAILED"); } } return 0; }

Be the first to answer this question.