ESP32 and EEPROM()
There is a library of EEPROM in arduino esp32, and the usage seems very easy and similar to arduino one.
and the size of eeprom can be defined at begin:
EEPROM.begin(EEPROM_SIZE)
and can be written with following, i is address, the 2nd one is the contain, which has a type of Byte
EEPROM.write(i,0x00)
EEPROM.commit();
for reading:
EEPROM.read(i)
pretty easy....But you need to have EEPROM.commit(); at the end otherwise nothing is saving into flash
now need to carefully calculate the data I need to write in.
and the size of eeprom can be defined at begin:
EEPROM.begin(EEPROM_SIZE)
and can be written with following, i is address, the 2nd one is the contain, which has a type of Byte
EEPROM.write(i,0x00)
EEPROM.commit();
for reading:
EEPROM.read(i)
pretty easy....But you need to have EEPROM.commit(); at the end otherwise nothing is saving into flash
now need to carefully calculate the data I need to write in.
- device Nr = byte
- softAP SSID and PSWD, let say 10 char each
Need to figure out how to arrange char string and byte array...
I need to get string of SSID and PSWD to byte[] array.
and will need to get byte[] array back to string
留言
張貼留言