Here, these are universal functions you should be able to use anywhere.
Call this function by using SaveFloat(your float); eg SaveFloat (12.34); or call float yourfloat = LoadFloat();
void SaveFloat (float input) {
String valstring = String(input);
int digitcount = 0;
for (int index = 0; index < valstring.length(); index++) {
if (String(valstring.charAt(index)) != ".") {
String temp = String(valstring.charAt(index));
int digit = temp.toInt();
EEPROM.update(index + 10, digit); // Change + 10 to whatever address you want to be the starting address. eg + 11 will be EEPROM.read(11);
} else {
EEPROM.update(index + 10, 254); // Change + 10 to whatever address you want to be the starting address. eg + 11 will be EEPROM.read(11);
}
digitcount++;
}
EEPROM.update(9, digitcount); //This address is important, so set it to an address you arent using.
}
float LoadFloat () {
String output = "";
for (int index = 0; index < EEPROM.read(//where you stored "digitcount"); index++) {
if (EEPROM.read (index + 10) < 10) { // Change + 10 to whatever address you want to be the starting address. eg + 11 will be EEPROM.read(11);
output += EEPROM.read (index + 10); // Change + 10 to whatever address you want to be the starting address. eg + 11 will be EEPROM.read(11);
} else {
output += ".";
}
}
return output.toFloat();
}