.write8
DESCRIPTION
.write writes a byte at a given address in the EEPROM.
SYNTAX
.write8(int,byte)
PARAMETERS
int, the address were the byte will be store
byte, the byte to be store at the above address.
RETURNS
none
EXAMPLE
#include
#include
// Must run first the first Example to Write the Strings to EEPROM InvIoT_EEPROM e1(0, 0x50); InvIoT_EEPROM e2(4096, 0x50); void setup() { Serial.begin(115200); Wire.begin(); Serial.println("This is all the Strings in e1 block, starting at address 0 so far..."); viewStringsAndInfo(e1); Serial.print("\n\n\nThe first Block ends at address: "); Serial.println(e1.endAddress()); Serial.println("The next block was set to start at 4096, so in between you have an unused memory"); Serial.println("Lets give some extra room for future strings add, and lets play with storing and retreiving bytes\n\n"); Serial.println("Storing from address 1200 up to 1400..."); int x=0; for (int y=1200;y<1400;y++){ e1.write8(y,x); x++; } Serial.println("\n\nDone storing.\n\nRead time."); for(int y=1200;y<1400;y++){ Serial.print("Address: ");Serial.print(y);Serial.print(", value: "); Serial.println(e1.read8(y)); } } void loop() { } void viewStringsAndInfo(InvIoT_EEPROM eeprom) { Serial.println(F("\n********************\nView String and Info\n********************")); Serial.print(F(".numberOfStrings(), returns how many strings are in the EEPROM. ")); Serial.println(eeprom.numberOfStrings()); Serial.print(F(".startAddress(), returns the first address used in this block. ")); Serial.println(eeprom.startAddress()); Serial.print(F(".endAddress(), returns the last address used in this block. ")); Serial.println(eeprom.endAddress()); Serial.println(); for (byte x = 0; x < eeprom.numberOfStrings(); x++) { Serial.print(F("S(")); Serial.print(x); Serial.print(") = "); Serial.println(eeprom.S(x)); } Serial.println(F("********************")); }
SEE ALSO