Skip to content

Instantly share code, notes, and snippets.

@MKo-xx
Created February 15, 2011 11:44
Show Gist options
  • Save MKo-xx/827430 to your computer and use it in GitHub Desktop.
Save MKo-xx/827430 to your computer and use it in GitHub Desktop.
EEPROM
#include <EEPROM.h> // include library
int sz; // size of received data
void setup()
{
Serial.begin(9600);
sz = 0;
}
void loop()
{
if(0 < Serial.available())
{
int r = Serial.read();
if ('s' == r) {
Serial.println("\nYour history");
for(int i=0; i<sz; ++i)
Serial.print(EEPROM.read(i));
Serial.println();
}
EEPROM.write(sz++, r);
}
delay(200);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment