How to use EPPROM for memory value(float) in my code (Arduino mega2560+Ethernet)

How to use EPPROM for memory value(float) in my code (Arduino mega2560+Ethernet)
i need record value
TIMELOAD = 0;
TIMESPRAYON = 0;
TIMESPRAYOFF = 0;
TIMEUNLOAD =0;
TIMEUNPLAN =0;
QTYNOGOODBOARD =0;
TOTAL =0;

for prevent value missing after my arduino shutdown
and sorry for my english

#include <SPI.h>
#include <Ethernet.h>
#include <SimpleTimer.h>

SimpleTimer timer;

const int  SW1 = 5;
const int  SW2 = 6;
const int  SW3 = 7;
const int  SW4 = 8;
const int  SW5 = 9;

float LOAD =0;
float SPRAYON = 0;
float SPRAYOFF = 0;
float UNLOAD = 0;
float NOGOODBOARD = 0;

float AFTERLOAD =0;
float AFTERSPRAYON = 0;
float AFTERSPRAYOFF = 0;
float AFTERUNLOAD = 0;
float AFTERNOGOODBOARD = 0;

float TIMELOAD = 0;
float TIMESPRAYON = 0;
float TIMESPRAYOFF = 0;
float TIMEUNLOAD =0;
float TIMEUNPLAN =0;
float QTYNOGOODBOARD =0;
float TOTAL =0;

float MTIMELOAD = 0;
float MTIMESPRAYON = 0;
float MTIMESPRAYOFF = 0;
float MTIMEUNLOAD = 0;
float MTIMEUNPLAN = 0;
float MQTYNOGOODBOARD = 0;

float LOADINGTIME =0;
float SPEED = 0;
float AVALIBILITY = 0;
float QUALITY =0;
float OEE = 0;

byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
IPAddress ip(172, 16, 10, 28);

EthernetServer server(80);

void setup() {
  Serial.begin(9600);

  pinMode(SW1, INPUT);
  pinMode(SW2, INPUT);
  pinMode(SW3, INPUT);
  pinMode(SW4, INPUT);
  pinMode(SW5, INPUT);
  
  timer.setInterval(1000, LOADSTART);
  timer.setInterval(1000, SPRAYSTART);
  timer.setInterval(1000, SPRAYSTOP);
  timer.setInterval(1000, UNLOADSTOP);
  timer.setInterval(1, NOGOOD);

  while (!Serial) {
    ;
  }

  Ethernet.begin(mac, ip);
  server.begin();
  Serial.print("server is at ");
  Serial.println(Ethernet.localIP());

}

void LOADSTART() 
{
  if (LOAD != AFTERLOAD) 
  {
  if (LOAD == HIGH) 
    {
      TIMELOAD++;
    } 
  }
}

void SPRAYSTART() 
{
  if (SPRAYON != AFTERSPRAYON) 
  {
  if (SPRAYON == HIGH) 
    {
      TIMESPRAYON++;
    } 
  }
}

void SPRAYSTOP() 
{
  if (SPRAYOFF != AFTERSPRAYOFF) 
  {
  if (SPRAYOFF == HIGH) 
    {
      TIMESPRAYOFF++;
    } 
  }
}

void UNLOADSTOP() 
{
  if (UNLOAD != AFTERUNLOAD) 
  {
  if (UNLOAD == HIGH) 
    {
      TIMEUNLOAD++;
    } 
  }
}

void NOGOOD() 
{
  if (NOGOODBOARD != AFTERNOGOODBOARD) 
  {
  if (NOGOODBOARD == HIGH) 
    {
      QTYNOGOODBOARD++;
    } 
  }
  AFTERNOGOODBOARD = NOGOODBOARD;
}



void loop() 
{
  timer.run();
  
  LOAD = digitalRead(SW1);
  SPRAYON = digitalRead(SW2);
  SPRAYOFF = digitalRead(SW3);
  UNLOAD = digitalRead(SW4);
  NOGOODBOARD = digitalRead(SW5);
  
 //-------------STD Time-------------//
 
 MTIMELOAD = TIMELOAD/60;
 
 //-------------Actual Time-------------//
 
 MTIMESPRAYON = TIMESPRAYON/60;
 MTIMESPRAYOFF = TIMESPRAYOFF/60;
 
 //-------------Plan-------------//
 
 MTIMEUNLOAD = TIMEUNLOAD/60;
 
 //-------------Unplan-------------//
 
 TIMEUNPLAN = (MTIMESPRAYOFF - MTIMEUNLOAD);
 
 //-------------Quality Loss-------------//
 
 MQTYNOGOODBOARD = QTYNOGOODBOARD/60;
 
 //-------------Total Time-------------//
 
 TOTAL = (MTIMESPRAYON + MTIMESPRAYOFF);
  
 //-------------Loading Time-------------//
 
 LOADINGTIME = (TOTAL - MTIMEUNLOAD);
  
 //-------------Speed Factor-------------//
 
 SPEED = (MTIMELOAD / MTIMESPRAYON) * 100;
  
 //-------------Avalibility Factor-------------//
 
 AVALIBILITY = (MTIMESPRAYON / LOADINGTIME) * 100;
  
 //-------------Quality Factor-------------//
 
 QUALITY = ((MTIMELOAD - MQTYNOGOODBOARD) / MTIMELOAD) * 100;
  
 //-------------OEE-------------//
 
 OEE = (SPEED * AVALIBILITY * QUALITY) / 10000;
  
 //-------------End-------------//
 

  EthernetClient client = server.available();
  if (client) {
    Serial.println("new client");
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.write(c);
        if (c == '\n' && currentLineIsBlank) {
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connection: close");
          client.println("Refresh: 5");
          client.println();
          client.println("<!DOCTYPE HTML>");
          client.println("<html>");
          client.println("<head><title>OEE Solder Mask E-Spray</title></head>");
          client.println("<font size=");
          client.println(6);
          client.println(">");
          client.println("OEE Solder Mask E-Spray");
          client.println("
");
          client.println("Total Time : ");
          client.println(TOTAL);
          client.println("
");
          client.println("STD Running Time : ");
          client.println(MTIMELOAD);
          client.println("
");
          client.println("Actual Running Time : ");
          client.println(MTIMESPRAYON);
          client.println("
");
          client.println("Planed Time : ");
          client.println(MTIMEUNLOAD);
          client.println("
");
          client.println("Unplaned Time : ");
          client.println(TIMEUNPLAN);
          client.println("
");
          client.println("Loading Time : ");
          client.println(LOADINGTIME);
          client.println("
");
          client.println("Quality Loss Time : ");
          client.println(MQTYNOGOODBOARD);
          client.println("
");
          client.println();
          client.println("
");
          client.println("Speed Factor : ");
          client.println(("%.2f",SPEED));
          client.println(" %");
          client.println("
");    
          client.println("Avalibility Factor : ");
          client.println(("%.2f",AVALIBILITY));
          client.println(" %");
          client.println("
");
          client.println("Quality Factor : ");
          client.println(("%.2f",QUALITY)); 
          client.println(" %");
          client.println("
");
          client.println("OEE : ");
          client.println(("%.2f",OEE)); 
          client.println(" %");      
          client.println("
");
          client.println("<a href=");
          client.println("files/TEST.txt");
          client.println(">Link to Download</a>");
          client.println("</font>");
          client.println("</html>");
          break;
        }
        if (c == '\n') {
          currentLineIsBlank = true;
        }
        else if (c != '\r') {
          currentLineIsBlank = false;
        }
      }
    }
    delay(1000);
    client.stop();
    Serial.println("client disconnected");
  }
}

thank you for all recomment

Hi dajimmans,

Just use EEPROM Anything detailed here: https://playground.arduino.cc/Code/EEPROMWriteAnything.

It allows you to store and read floats or for that matter any data structure.

thank you sir

The standard EEPROM.h library packaged with the ide has the functions put() and get() to store and retrieve any data type. It is well documented and has library examples. EEPROMWriteAnything is from a period when the standard EEPROM library did not have these functions.

I would stick with EEPROM.h to stay on a well traveled path.