cpp
cpp
- Writes an
array of bytes
to the address specified.
- Writes an
array of chars
to the address specified.
Address in memory where the data is to be written to. Mandatory
Pointer to data buffer to write the array from. Mandatory
Size of the array to be written out to flash memory. Mandatory
Refer to Advanced use <noteOnErrorCheck>
Optional
Write the array of values of the datatype and size specified by the user, to the address provided
Returns TRUE
if data written successfully, else returns FALSE
#include <SPIMemory.h>
SPIFlash flash;
#define _bufferSize 8
uint8_t dataOut[_bufferSize] = {0,1,2,3,4,5,6,7};
// This data type should be changed depending on the type of data being written to the flash memory
uint32_t _address;
void setup() {
flash.begin();
_address = flash.getAddress(sizeof(dataIn));
Serial.print(F("Address = "));
Serial.println(_address);
Serial.print(F("Data write: "));
if (flash.writeByteArray(_address, dataOut, _bufferSize) {
// This function should be changed depending on the type of data being written to the flash memory
Serial.println(F("Successful"));
}
else {
Serial.println(F("Failed"));
}
}
void loop() {
}