This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
arduino-docs [2015/04/16 22:45] mer [ESP8266WiFi] |
arduino-docs [2015/07/19 01:19] (current) apedro [EEPROM] |
||
---|---|---|---|
Line 8: | Line 8: | ||
==== Wire ==== | ==== Wire ==== | ||
- | |||
content | content | ||
==== EEPROM ==== | ==== EEPROM ==== | ||
+ | EEPROM functionality is similar to the standard Arduino library with the exception of having to declare memory size and committing writes. | ||
+ | ===example=== | ||
+ | <code c++> | ||
+ | #include <EEPROM.h> | ||
- | content | + | void setup() |
+ | { | ||
+ | //Init EEPROM, note the size requirement. I believe 4096B is the maximum available. | ||
+ | //You could use a smaller amount/size. | ||
+ | EEPROM.begin(4096); | ||
+ | for( int i = 0; i < 4096; i++ ) | ||
+ | { | ||
+ | EEPROM.write(i,i); | ||
+ | } | ||
+ | EEPROM.commit(); //note here the commit! | ||
+ | } | ||
+ | </code> | ||
+ | NOTE: EEPROMAnything can be used with one simple modification. | ||
+ | Find the EEPROMAnything.h and add EEPROM.commit(); after the EEPROM.write(ee++, *p++); | ||
+ | |||
+ | EEPROMAnything provides nice functionality to save any type of variable including structers. | ||
+ | <code c++> | ||
+ | #include <EEPROMAnything.h> | ||
+ | |||
+ | struct eepromInfoType | ||
+ | { | ||
+ | uint8_t MyUnsigned8BitInt; | ||
+ | char MyCharArray[25] | ||
+ | } myStructOriginal, myStructCopy; | ||
+ | |||
+ | void setup() | ||
+ | { | ||
+ | myStructOriginal.MyUnsigned8BitInt = 0; //assign some value | ||
+ | strcpy( myStructOriginal.MyCharArray, "Less than 25 chars" ); //assign some value | ||
+ | EEPROM_writeAnything( 0, myStructOriginal ); //remember to modify EEPROM_writeAnything by adding .commit(). | ||
+ | //Lets read it back | ||
+ | EEPROM_readAnything( 0, myStructCopy ); | ||
+ | } | ||
+ | |||
+ | void loop() | ||
+ | { | ||
+ | //nothing here | ||
+ | } | ||
+ | </code> | ||
===== ESP Specific Libs ===== | ===== ESP Specific Libs ===== | ||
Line 75: | Line 116: | ||
**Connect with static IP** | **Connect with static IP** | ||
+ | |||
+ | If you experience problems regarding DNS resolving check out https://github.com/esp8266/Arduino/issues/369 | ||
<code c> | <code c> | ||
#include <ESP8266WiFi.h> | #include <ESP8266WiFi.h> |