Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

esp8266 eeprom put

sspence65 Jun 20th, 2018 84 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. #include <EEPROM.h>
  2.  
  3. struct MyObject {
  4.   char ssid[20]; // 1 more than the length of the array content
  5.   char password[20]; // 1 more than the length of the array content
  6.  
  7. };
  8.  
  9. void setup() {
  10.  
  11.   Serial.begin(9600);
  12.  
  13.   int eeAddress = 0;   //Location we want the data to be put.
  14.  
  15.   EEPROM.begin(1024);
  16.  
  17.   /** Put is designed for use with custom structures also. **/
  18.  
  19.   //Data to store.
  20.   MyObject customVar = {
  21.     "your_ssid",
  22.     "your_passwd"
  23.   };
  24.  
  25.  
  26.   EEPROM.put(eeAddress, customVar);
  27.   EEPROM.commit();
  28.   Serial.print("Written custom data type! \n\nView the example sketch eeprom_get to see how you can retrieve the values!");
  29. }
  30.  
  31. void loop() {
  32.   /* Empty loop */
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top