Skip to content

write()

Arnd edited this page Dec 11, 2020 · 4 revisions

write(address,data)

The begin() function searches for all available I2C MB85nnn memories and combines them to form one large contiguous memory. The address parameter therefore can be up to an unsigned 32 bit number. The data parameter can be any data type. The Arduino wire library limits the I2C buffer size to 32 bytes, but this library allows for any size variables to be written. If a read goes past the end of memory it starts again at address 0. The optional return value is the number of bytes written.


###Example

MB85_FRAM_Class FRAM;
...
uint8_t chips_detected = FRAM.begin(); // return number of memories
char testArray[13] = "Hello World!";
FRAM.write(200,testArray); // write to address 200
FRAM.read(200,testArray); // read from address 200
Serial.print("Read string array as \"");
Serial.print(testArray);
Serial.println("\".");
...
Clone this wiki locally