Hi, this is the first time I try to use the EEPROM, I was able to read the values on port A0 by pressing the D6 button, but as soon as I restart I lose the value stored in the variable "min value".
Can someone help me ?
Thanks.
BlynkTimer timer;
#include <EEPROM.h>
int val0 = 1;
int Livello = 0; // variabile di memorizzazione
int valoremin ; // valore minimo rilevabile
int valoremax = 200 ; // valore massimo rilevabile
void setup(){
Serial.begin(115200);
pinMode (D6,INPUT_PULLUP); //Pulsante
timer.setInterval(2000L, myTimerEvent);
}
void myTimerEvent(){
val0 = digitalRead(D6); // legge il valore dell'input
if (val0 == LOW) {
Serial.println("SCRITTURA EEPROM VALOREMIN");
valoremin = analogRead (A0);// acquisisce il segnale dal sensore A0
delay (3000);
Serial.println("SCRITTURA EEPROM COMPLEATA");
delay (3000);}
Livello = analogRead (A0);// acquisisce il segnale dal sensore livello acqua
valoremin = EEPROM.read (0);
Serial.print ("Livello: = ");
Serial.print (Livello); // espone il livello sulla seriale
Livello = map(Livello, valoremin, valoremax, 0, 100);
Serial.print(Livello);