4 * Stores values read from analog input 0 into the EEPROM.
5 * These values will stay in the EEPROM when the board is
6 * turned off and may be retrieved later by another sketch.
11 // the current address in the EEPROM (i.e. which byte
12 // we're going to write to next)
21 // need to divide by 4 because analog inputs range from
22 // 0 to 1023 and each byte of the EEPROM can only hold a
23 // value from 0 to 255.
24 int val = analogRead(0) / 4;
26 // write the value to the appropriate byte of the EEPROM.
27 // these values will remain there when the board is
29 EEPROM.write(addr, val);
31 // advance to the next address. there are 512 bytes in
32 // the EEPROM, so go back to 0 when we hit 512.