Store a Value in EEPROM
Write and read non-volatile settings.
Store a Value in EEPROM is a free Arduino & IoT Academy lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Arduino & IoT Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Memory That Forgets
Normal variables live in RAM, which wipes clean the moment power drops. To keep a setting around, you need memory that remembers.
Meet EEPROM
EEPROM is a small block of storage built into the chip that survives power loss. Think of it as a tiny notepad that stays written.
How Much Space
An Arduino Uno gives you about 1024 bytes of EEPROM. It is small, so save settings and counters, not big logs.
Addresses, Not Names
EEPROM is organized by numbered slots called addresses, starting at 0. You choose which address holds each value.
Include the Library
To use it, pull in the built-in EEPROM library at the top of your sketch. No download needed; it ships with the IDE.
#include <EEPROM.h>Write a Byte
EEPROM.write stores one byte at an address. Here we save the number 42 into slot 0.
EEPROM.write(0, 42);Read It Back
EEPROM.read fetches the byte you stored. Read slot 0 and you get your value back, even after a reset.
byte value = EEPROM.read(0);One Byte Holds 0 to 255
A single byte stores values from 0 to 255. To save a larger number, you split it across several addresses.
Save Bigger Values Easily
For ints, floats, or structs, use EEPROM.put and EEPROM.get. They handle the byte splitting for you automatically.
int score = 1500;
EEPROM.put(0, score);Writes Wear Out
EEPROM survives roughly 100,000 writes per cell. Don't write every loop, or you'll burn it out fast.
Write Only on Change
Use EEPROM.update instead of write. It skips the write when the value is unchanged, sparing the memory.
EEPROM.update(0, 42);Quick Check
Let's check why we reach for EEPROM at all.
Recap: Persistent Storage
You saw EEPROM as non-volatile memory, wrote and read bytes by address, and learned to limit writes. Your settings can now persist! 💾
Frequently asked questions
Is the “Store a Value in EEPROM” lesson free?
Yes — the full text of “Store a Value in EEPROM” is free to read here on the web, and the Arduino & IoT Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Arduino & IoT Academy course, upgrade to CoddyKit PRO.
What will I learn in “Store a Value in EEPROM”?
Write and read non-volatile settings. You practise Arduino & IoT Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Arduino & IoT Academy?
No prior experience is required. Arduino & IoT Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Store a Value in EEPROM” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Arduino & IoT Academy lesson?
Yes. Every Arduino & IoT Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Why Buttons 'Bounce'
- Debounce with millis()
- Store a Value in EEPROM
- Remember a Counter After Reset