cd esp8266/tools
python get.py
Wire.begin(int sda, int scl)
Hello guys, currently I am working on ESP's EEPROM.
This is the code I have written.. just to start with.
#include <EEPROM.h>
struct createObject
{
String title;
String startFrom;
String endAt;
String location;
String appl;
short int itsStat;
};
int damnsize;
void setup()
{
EEPROM.begin(1024);
struct createObject object1;
damnsize = sizeof(createObject);
Serial.begin(115200);
Serial.print(damnsize);
object1.title = "This is some string";
object1.startFrom = "123456789012";
object1.endAt = "abcdefghijkl";
object1.location = "Sun";
object1.appl = "greenlight";
object1.itsStat = 1;
Serial.println();
Serial.println(object1.title);
Serial.println(object1.startFrom);
Serial.println(object1.endAt);
Serial.println(object1.location);
Serial.println(object1.appl);
Serial.println(object1.itsStat);
EEPROM.put(damnsize, object1);
//while(!EEPROM.commit());
object1.title = "randomStringHere";
object1.startFrom = "newnum";
object1.endAt = "booya";
object1.location = "random";
object1.appl = "something";
object1.itsStat = NULL;
damnsize = sizeof(createObject);
EEPROM.get(damnsize, object1);
Serial.println(object1.title);
Serial.println(object1.startFrom);
Serial.println(object1.endAt);
Serial.println(object1.location);
Serial.println(object1.appl);
Serial.println(object1.itsStat);
delay(5000);
}
void loop(){//Empty}
And I got this output in Serial monitor:
This is some string
123456789012
abcdefghijkl
Sun
greenlight
1
randomStringHere ng
newnum 89012
booya ghijkl
ran
something
1
This is code algorithm
1) create a structure
2) Create new structure(roughly, an object)
3) Store values manually
4) Write those values to EEPROM using EEPROM.put() method.
5) Change values in the code manually.
6) Read values back from EEPROM to check whether the info was written in EEPROM or not.
But I am getting weird output on serial monitor.