2022-04-04 02:37:38 -04:00
|
|
|
# EEPROM
|
|
|
|
|
2022-04-04 14:40:51 -04:00
|
|
|
***Electrically Erasable Programmable Read-Only Memory***
|
2022-04-04 02:37:38 -04:00
|
|
|
|
|
|
|
### Funciones
|
|
|
|
|
|
|
|
```C
|
|
|
|
#include <EEPROM.h>
|
|
|
|
#define dirVAR 0
|
|
|
|
#define dirVAR1 1
|
|
|
|
#define dirVAR2 3
|
|
|
|
#define VAR 39
|
|
|
|
#define VAR1 32767
|
|
|
|
#define VAR2 2
|
|
|
|
|
|
|
|
void setup() {
|
2022-04-04 14:40:51 -04:00
|
|
|
Serial.begin(9600);
|
|
|
|
delay(2000);
|
|
|
|
Serial.print("Capacidad de memoria");
|
|
|
|
Serial.println(EEPROM.length());
|
|
|
|
delay(500);
|
|
|
|
Serial.print("Valor almacenado en direccion 0: ");
|
|
|
|
Serial.println(EEPROM.read(dirVAR)); //read(direccion)
|
|
|
|
delay(500);
|
|
|
|
Serial.println("Guardando 39 en direccion 0");
|
|
|
|
EEPROM.write(dirVAR, VAR); //Write(direccion, valor)
|
|
|
|
delay(500);
|
|
|
|
Serial.println("Guardando 32767 en direccion 1");
|
|
|
|
EEPROM.write(dirVAR1, VAR1); //Write(direccion, valor)
|
|
|
|
delay(500);
|
|
|
|
Serial.println("Guardando 2 en direccion 2");
|
|
|
|
EEPROM.write(dirVAR2, VAR2); //Write(direccion, valor)
|
|
|
|
delay(500);
|
2022-04-04 02:37:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void loop() {
|
2022-04-04 14:40:51 -04:00
|
|
|
Serial.print("Valor en direccion 0: ");
|
|
|
|
Serial.println(EEPROM.read(dirVAR));
|
|
|
|
Serial.print("Valor en direccion 1: ");
|
|
|
|
Serial.println(EEPROM.read(dirVAR1));
|
|
|
|
Serial.print("Valor en direccion 3: ");
|
|
|
|
Serial.println(EEPROM.read(dirVAR2));
|
|
|
|
delay(500);
|
2022-04-04 02:37:38 -04:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Pendiente (put)
|
|
|
|
|