0
0
Arduinoprogramming~10 mins

EEPROM read and write in Arduino - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to write the value 42 to EEPROM address 0.

Arduino
#include <EEPROM.h>

void setup() {
  EEPROM.[1](0, 42);
}

void loop() {}
Drag options to blanks, or click blank then click option'
Awrite
Bread
Cupdate
Dbegin
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'read' instead of 'write' will not store data.
Using 'begin' is for initializing EEPROM, not writing.
2fill in blank
medium

Complete the code to read a byte from EEPROM address 0 and store it in variable 'val'.

Arduino
#include <EEPROM.h>

void setup() {
  byte val = EEPROM.[1](0);
}

void loop() {}
Drag options to blanks, or click blank then click option'
Aupdate
Bwrite
Ccommit
Dread
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'write' instead of 'read' will overwrite data.
Using 'commit' is for saving changes in some EEPROM types, not reading.
3fill in blank
hard

Fix the error in the code to update EEPROM address 1 only if the value is different.

Arduino
#include <EEPROM.h>

void setup() {
  byte newVal = 100;
  EEPROM.[1](1, newVal);
}

void loop() {}
Drag options to blanks, or click blank then click option'
Awrite
Bupdate
Cread
Dcommit
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'write' always writes even if value is the same, reducing EEPROM life.
Using 'read' does not write data.
4fill in blank
hard

Fill both blanks to write value 55 to EEPROM address 2 and then read it back into 'val'.

Arduino
#include <EEPROM.h>

void setup() {
  EEPROM.[1](2, 55);
  byte val = EEPROM.[2](2);
}

void loop() {}
Drag options to blanks, or click blank then click option'
Awrite
Bread
Cupdate
Dcommit
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'update' instead of 'write' is okay but not required here.
Using 'commit' is not needed for basic EEPROM operations.
5fill in blank
hard

Fill all three blanks to update EEPROM address 3 with 77 only if different, then read it into 'val', and finally write 88 to address 4.

Arduino
#include <EEPROM.h>

void setup() {
  EEPROM.[1](3, 77);
  byte val = EEPROM.[2](3);
  EEPROM.[3](4, 88);
}

void loop() {}
Drag options to blanks, or click blank then click option'
Awrite
Bread
Cupdate
Dcommit
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'write' instead of 'update' for the first blank causes unnecessary writes.
Mixing up read and write functions.