Created
February 15, 2011 11:44
-
-
Save MKo-xx/827430 to your computer and use it in GitHub Desktop.
EEPROM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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