I've searched online and saw this link " https://www.best-microcontroller-projects.com/arduino-eeprom.html#:~:text=Arduino%20EEPROM%20get%20vs%20read,bytes%20starting%20from%20an%20address. " but I'm still not understanding how EEPROM.read(address) and EEPROM.get(address) is any different.
I created this code, to see if the EEPROM.get() will read bytes starting from the first address to the last address.
#include <EEPROM.h>
int address = 0;
int eeAddress = 0;
byte value;
float f = 0.00f;
void setup() {
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
}
void loop() {
//--------------------EEPROM.get()-----
Serial.println("---Using EEPROM.get()----");
EEPROM.get(eeAddress, f);
Serial.print(".get() address: ");
Serial.println(eeAddress);
Serial.print(".get() value: ");
Serial.println(f, 3);
//-------------------EEPROM.read()------
Serial.println("---Using EEPROM.read()----");
value = EEPROM.read(address);
Serial.print(".read() address: ");
Serial.println(address);
Serial.print(".read() value: ");
Serial.println(value, DEC);
}
Im only getting "-0.000" as a result for EEPROM.get() and "3" for EEPROM.read(). Im not understanding the difference between them.