I want to retrieve my data from the EEPROM after the code has finished running. I am trying to use a photon particle and get the data via serial. I want to get and print myData after we run the code. We’re using CoolTerm to read data off of the photon, but it’s not printing myData from the line Serial.print(EEPROM.get(eedress, myData)). I have included our code below. Any suggestions?
But obviously EEPROM.get(eedress, myData) will only return one char.
Is this what you expect?
Also reusing a global variable name for a local variable is generally not considered good practice.
However, the reason for your trouble is that String is not a datatype that stores well via EEPROM since the actual string is not stored in the object. The object only holds a pointer to the string on the heap, but once destructed that pointer will be invalid.
char myData = myData was suppose to be opening a variable that is call-able. I’m having trouble trying to understand how to write the three variables which are all doubles (voltage, theFlow, time) into EEPROM.get().
We tried to to write one of the variables in EEPROM, but this returned nan. Do you have thoughts on how to write it properly and how to pull it after it’s written? Thanks!
We made a struct and have it writing to the EEPROM, but now we want to be able to pull the data all at once upon startup. At this time, it’s writing as the loop goes. How will we go about doing this? Thank you!
Does it have to be called in serial to get the data from the EEPROM? We tried to call the EEPROM struct through the serial in the setup() and did not receive the data. This is what we have right now for our code. Thanks!
The Serial.print() function has no overload that can take a struct as input parameter. Hence you need to read the data into a variable and use that then.
One way could be as you did it or like this
@marytovillo, where in your code do you set the initial value for eedress? That parameter is the address in EEPROM from which you’re reading. I don’t see where you are setting that value for the initial read in setup().