0
0
Arduinoprogramming~10 mins

EEPROM for storing settings 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 include the EEPROM library.

Arduino
#include <[1]>
Drag options to blanks, or click blank then click option'
AEEPROM.h
BServo.h
CSPI.h
DWire.h
Attempts:
3 left
💡 Hint
Common Mistakes
Including the wrong library like Wire.h or SPI.h instead of EEPROM.h.
2fill in blank
medium

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

Arduino
EEPROM.[1](0, 42);
Drag options to blanks, or click blank then click option'
Aupdate
Bread
Cwrite
Dget
Attempts:
3 left
💡 Hint
Common Mistakes
Using EEPROM.read instead of EEPROM.write to store data.
3fill in blank
hard

Fix the error in reading a byte from EEPROM address 1.

Arduino
byte value = EEPROM.[1](1);
Drag options to blanks, or click blank then click option'
Awrite
Bupdate
Cput
Dread
Attempts:
3 left
💡 Hint
Common Mistakes
Using EEPROM.write or EEPROM.put instead of EEPROM.read for reading.
4fill in blank
hard

Fill both blanks to write a value only if it differs from the current EEPROM value.

Arduino
if (EEPROM.[1](5) != newValue) {
  EEPROM.[2](5, newValue);
}
Drag options to blanks, or click blank then click option'
Aread
Bwrite
Cupdate
Dget
Attempts:
3 left
💡 Hint
Common Mistakes
Using write for both reading and writing.
Not checking if the value is different before writing.
5fill in blank
hard

Fill all three blanks to store and retrieve an integer value using EEPROM.put and EEPROM.get.

Arduino
int storedValue = 0;

EEPROM.[1](10, newValue);
EEPROM.[2](10, [3]);
Drag options to blanks, or click blank then click option'
Awrite
Bget
CstoredValue
Dput
Attempts:
3 left
💡 Hint
Common Mistakes
Using write and read instead of put and get for integers.
Not passing a variable to EEPROM.get.