okay so i stored the long variables in the eeprom with the first eeprom.put() i posted right above. but now when i read them it dont display the correct value?
#include <EEPROM.h>
void setup() {
unsigned long t1ontimeDAY = 10700; /////
unsigned long t1offtimeDAY = 10000;
unsigned long t2ontimeDAY = 13400; /////
unsigned long t2offtimeDAY = 10000;
unsigned long t3ontimeDAY = 0; /////
unsigned long t3offtimeDAY = 0;
unsigned long t1ontimeNIGHT = 10000; /////
unsigned long t1offtimeNIGHT = 50000;
unsigned long t2ontimeNIGHT = 12400; /////
unsigned long t2offtimeNIGHT = 50000;
unsigned long t3ontimeNIGHT = 10; /////
unsigned long t3offtimeNIGHT = 10; //Variable to store data read from EEPROM.
int eeAddress = 0; //EEPROM address to start reading from
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.print("Read float from EEPROM: ");
//Get the float data from the EEPROM at position 'eeAddress'
EEPROM.get(eeAddress, t1ontimeDAY);
EEPROM.get(eeAddress, t1offtimeDAY);
EEPROM.get(eeAddress, t2ontimeDAY);
EEPROM.get(eeAddress, t2offtimeDAY);
EEPROM.get(eeAddress, t3ontimeDAY);
EEPROM.get(eeAddress, t3offtimeDAY);
EEPROM.get(eeAddress, t1ontimeNIGHT);
EEPROM.get(eeAddress, t1offtimeNIGHT);
EEPROM.get(eeAddress, t2ontimeNIGHT);
EEPROM.get(eeAddress, t2offtimeNIGHT);
EEPROM.get(eeAddress, t3ontimeNIGHT);
EEPROM.get(eeAddress, t3offtimeNIGHT);
Serial.println(t1ontimeDAY); //This may print 'ovf, nan' if the data inside the EEPROM is not a valid float.
}
/***
As get also returns a reference to 'f', you can use it inline.
E.g: Serial.print( EEPROM.get( eeAddress, f ) );
***/
/***
Get can be used with custom structures too.
I have separated this into an extra function.
***/
void loop() {
/* Empty loop */
}