Arduinos come with a small amount of memory built in. For simple projects, you can write data to the EEPROM (electronically erasable programmable read-only memory). Unlike variable used in previous programs, this data will remain even after you turn it off. Here's an example that writes "1" to all the memory, but you could easily change this to write any byte of data (numbers from 0-255). We'll show you how to read it later
// The EEPROM library allows us to save data even after we turn the power off
// but it doesn't allow for much storage. Big projects need something else
#include <EEPROM.h>
int addr = 0;
void setup()
{
delay(5000); // Wait before writing data in case you want to read instead
}
void loop()
{
// Change the second variable below from "1" to whatever data you want stored
EEPROM.write(addr, 1);
addr = addr + 1;
if (addr == EEPROM.length()) addr = 0;
// Uncomment the next line to slow data collection to last ~24 hours
// delay(85000);
}