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

esp8266 eeprom get

sspence65 Jun 20th, 2018 83 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. #include <EEPROM.h>
  2. int eeAddress = 0; //EEPROM address to start reading from
  3.  
  4.  
  5. void setup() {
  6.  
  7.  
  8.   Serial.begin(9600);
  9.  
  10.   EEPROM.begin(1024);
  11.  
  12.   //Get the float data from the EEPROM at position 'eeAddress'
  13.  
  14.  
  15.  
  16.   /***
  17.     Get can be used with custom structures too.
  18.     I have separated this into an extra function.
  19.   ***/
  20.  
  21.   secondTest(); //Run the next test.
  22. }
  23.  
  24. struct MyObject {
  25.   char ssid[20];
  26.   char password[20];
  27.  
  28. };
  29.  
  30. void secondTest() {
  31.  
  32.   MyObject customVar; //Variable to store custom object read from EEPROM.
  33.   EEPROM.get(eeAddress, customVar);
  34.  
  35.   Serial.println("Read custom object from EEPROM: ");
  36.   Serial.println(customVar.ssid);
  37.   Serial.println(customVar.password);
  38.  
  39. }
  40.  
  41. void loop() {
  42.   /* Empty loop */
  43. }
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