Skip to content

Instantly share code, notes, and snippets.

@nseidle
Last active September 29, 2016 17:21
Show Gist options
  • Save nseidle/22fcc908a77d633d539de98ec134045e to your computer and use it in GitHub Desktop.
Save nseidle/22fcc908a77d633d539de98ec134045e to your computer and use it in GitHub Desktop.
This is just a snippet. See the full files here: https://github.com/sparkfun/Genericized_Library_Examples
#include "Memory.h" //The example lib
Memory myStorage; //Instantiate an instance of the class
void setup()
{
Serial.begin(9600);
myStorage.begin(Wire); //Pass the I2C Port to the library
}
void loop()
{
myStorage.writeValue(12, 163); //Write value 163 into address 12
delay(10); //Give the EEPROM time to record this value
int value = myStorage.readValue(12); //Read what is in location 12
Serial.print("value (should be 163): ");
Serial.println(value);
delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment