How to save IPAddress to ESP32 Preferences?
Posted: Wed Sep 21, 2022 10:11 pm
Hi,
I have a captive portal where IPAddress is typed in. The result is stored in a variable as:
When I use a print statement, I can see that the IP address is saved and printed as 255,255,255,255, the same value I typed in the portal.
Now, how do I save this value (not sure if its a string as its stored in IPAddress format) in preferences memory of ESP32 and also how do I retrieve it in IPAddress format so that I can assign the IP on next reboot?
Kindly suggest. Thanks in advance
I have a captive portal where IPAddress is typed in. The result is stored in a variable as:
Code: Select all
strcpy(server, custom_server.getValue());
IPAddress _ip;
_ip.fromString(server);
Now, how do I save this value (not sure if its a string as its stored in IPAddress format) in preferences memory of ESP32 and also how do I retrieve it in IPAddress format so that I can assign the IP on next reboot?
Kindly suggest. Thanks in advance