#include <Arduino.h>
const uint32_t NVM_Offset = 0x290000;
uint8_t FLASH_Address = 0;
String StrIn = "Hi Dear Students do the Project with one real time application";
String StrOut;
template<typename T>
void FlashWrite(uint32_t address, const T& value) {
ESP.flashEraseSector((NVM_Offset+address)/4096);
ESP.flashWrite(NVM_Offset+address, (uint32_t*)&value, sizeof(value));
}
template<typename T>
void FlashRead(uint32_t address, T& value) {
ESP.flashRead(NVM_Offset+address, (uint32_t*)&value, sizeof(value));
}
void setup() {
Serial.begin(115200);
FlashWrite<String>(FLASH_Address, StrIn);
FlashRead<String>(FLASH_Address, StrOut);
Serial.println(StrOut);
}
void loop() {
delay(200);
}