Tutorial.EEPROMWrite History

Hide minor edits - Show changes to markup

September 03, 2015, at 10:09 AM by Simone Maiocchi -
Deleted line 49:
  • EEPROM Get – Get values from EEPROM and prints as float on serial.
September 03, 2015, at 09:55 AM by Simone Maiocchi -
Changed line 47 from:
  • EEPROM Clear - Fills the content of the EEPROM memory with “0”
to:
  • EEPROM Clear - Fills the content of the EEPROM memory with “0”.
September 03, 2015, at 09:52 AM by Simone Maiocchi -
Changed lines 1-6 from:
to:
September 03, 2015, at 09:51 AM by Simone Maiocchi -
Changed lines 41-49 from:
to:
  • EEPROM Clear - Fills the content of the EEPROM memory with “0”
  • EEPROM Read – Reads values stored into EEPROM and prints them on Serial.
  • EEPROM Crc – Calculates the CRC of EEPROM contents as if it was an array.
  • EEPROM Get – Get values from EEPROM and prints as float on serial.
  • EEPROM Iteration – Programming examples on how to go through the EEPROM memory locations.
  • EEPROM Put – Put values in EEPROM using variable semantics (differs from EEPROM.write() ).
  • EEPROM Get – Get values from EEPROM and prints as float on serial.
  • EEPROM Update – Stores values read from A0 into EEPROM, writing the value only if different, to increase EEPROM life.
August 18, 2015, at 02:14 PM by Simone Maiocchi -
August 18, 2015, at 02:06 PM by Simone Maiocchi -
Changed lines 11-12 from:

This example illustrates how to store values read from analog input 0 into the EEPROM using theEEPROM.write() function. These values will stay in the EEPROM when the board is turned off and may be retrieved later by another sketch.

to:

This example illustrates how to store values read from analog input 0 into the EEPROM using the EEPROM.write() function. These values will stay in the EEPROM when the board is turned off and may be retrieved later by another sketch.

August 18, 2015, at 02:05 PM by Simone Maiocchi -
Changed lines 1-11 from:
to:
Changed lines 5-17 from:
to:
Changed line 22 from:
to:
Added lines 25-28:

Schematics

image developed using Fritzing. For more circuit examples, see the Fritzing project page

Deleted line 30:
Changed lines 33-34 from:
to:
Changed lines 37-42 from:
to:
Changed lines 41-42 from:
to:


Last revision 2015/08/18 by SM

November 16, 2011, at 04:26 AM by Scott Fitzgerald -
Changed lines 27-28 from:
to:
September 28, 2010, at 01:21 PM by Tom Igoe -
Changed lines 27-60 from:
to:
September 23, 2010, at 10:46 PM by Christian Cerrito -
Changed lines 3-4 from:

EEPROM Write

to:

EEPROM Write

September 20, 2010, at 02:26 PM by Christian Cerrito -
Added lines 70-71:
September 20, 2010, at 02:26 PM by Christian Cerrito -
Changed lines 63-64 from:
to:
September 20, 2010, at 02:25 PM by Christian Cerrito -
Added lines 63-66:
September 20, 2010, at 02:16 PM by Christian Cerrito -
Changed lines 5-6 from:

Stores values read from analog input 0 into the EEPROM. These values will stay in the EEPROM when the board is turned off and may be retrieved later by another sketch.

to:

The microcontroller on the Arduino board has 512 bytes of EEPROM: memory whose values are kept when the board is turned off (like a tiny hard drive).

This example illustrates how to store values read from analog input 0 into the EEPROM using theEEPROM.write() function. These values will stay in the EEPROM when the board is turned off and may be retrieved later by another sketch.

September 20, 2010, at 02:13 PM by Christian Cerrito -
Added lines 7-12:
September 20, 2010, at 12:03 AM by Christian Cerrito -
Added lines 7-16:
September 16, 2010, at 11:11 PM by Tom Igoe -
Changed line 25 from:
  int val = analogRead(0) / 4;
to:
  int val = analogRead(A0) / 4;
September 16, 2010, at 11:11 PM by Tom Igoe -
Changed line 9 from:

[@

to:
Changed lines 40-41 from:

@]

to:
May 22, 2008, at 04:33 AM by David A. Mellis -
Changed lines 40-46 from:

@]

to:
May 22, 2008, at 04:30 AM by David A. Mellis -
Added lines 1-40:

Examples > EEPROM Library

EEPROM Write

Stores values read from analog input 0 into the EEPROM. These values will stay in the EEPROM when the board is turned off and may be retrieved later by another sketch.

Code

#include <EEPROM.h>

// the current address in the EEPROM (i.e. which byte
// we're going to write to next)
int addr = 0;

void setup()
{
}

void loop()
{
  // need to divide by 4 because analog inputs range from
  // 0 to 1023 and each byte of the EEPROM can only hold a
  // value from 0 to 255.
  int val = analogRead(0) / 4;

  // write the value to the appropriate byte of the EEPROM.
  // these values will remain there when the board is
  // turned off.
  EEPROM.write(addr, val);

  // advance to the next address.  there are 512 bytes in 
  // the EEPROM, so go back to 0 when we hit 512.
  addr = addr + 1;
  if (addr == 512)
    addr = 0;

  delay(100);
}

Share