So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By martinayotte
#70507
martinayotte wrote:
mahdinga wrote:hello guys!!!
in addition, i am saving a struct including some (String)s and (int)s(3 Strings and 12 int) and i use EEPROM.put(1,MyStruct); for saving data and EEPROM.get(1,MyStruct); for retrieving data.


Be carefull how you manage your String in the structure, because they are pointers to String object not to character array expected, so when restored, those pointers are pointing to no where, therefore you get such crashes...
Your structures should contains character arrays with predefined length, and then you should copy the String into it using "memcpy(st.str, str.c_str(), str.length());"
User avatar
By mahdinga
#70508 thank you all guys, for your attention :)

i found the problem...
special tnx to martinayotte

it resets the esp just because of using String in struct
i ignored using string somehow(too hard :( )
but the next problem is just killing me :cry:

i used just some integers in struct, esp work so fine, but the numbers still change frequently.
the most surprising part is that, the variables that they dont use eeprom, change too.
i can't find any relation between eeprom saving and reading codes and these necessary variables.

and i am using esp8266-07(without any platforms) and flashing it on Arduino IDE, using the last update of ESP Library board and...

the codes are more than i can put them here, but esp task is controlling a motor with pwm and reading a gyroscope sensor data and showing them inside http server and waiting for pwm orders from user.I have to use ssid and passwords that i can change it when i need to. and also saving some information in esp to read them after rebooting the esp

thanks again :)