Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <EEPROM.h>
- int eeAddress = 0; //EEPROM address to start reading from
- void setup() {
- Serial.begin(9600);
- EEPROM.begin(1024);
- //Get the float data from the EEPROM at position 'eeAddress'
- /***
- Get can be used with custom structures too.
- I have separated this into an extra function.
- ***/
- secondTest(); //Run the next test.
- }
- struct MyObject {
- char ssid[20];
- char password[20];
- };
- void secondTest() {
- MyObject customVar; //Variable to store custom object read from EEPROM.
- EEPROM.get(eeAddress, customVar);
- Serial.println("Read custom object from EEPROM: ");
- Serial.println(customVar.ssid);
- Serial.println(customVar.password);
- }
- void loop() {
- /* Empty loop */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement