Help value EEPROM lost after reboot

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 ?

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(){
pinMode (D6,INPUT_PULLUP); //Pulsante
timer.setInterval(2000L, myTimerEvent);


void myTimerEvent(){

val0 = digitalRead(D6); // legge il valore dell'input
if (val0 == LOW) {
valoremin = analogRead (A0);// acquisisce il segnale dal sensore A0
delay (3000);
delay (3000);}

Livello = analogRead (A0);// acquisisce il segnale dal sensore livello acqua
valoremin = (0);
Serial.print ("Livello: = ");
Serial.print (Livello); // espone il livello sulla seriale

Livello = map(Livello, valoremin, valoremax, 0, 100);

Your post was MOVED to its current location as it is more suitable.

Please follow the advice given in the link below when posting code. Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

Which Arduino board are you using ?

Where is the EEPROM.write?

Why do you read only one byte into a two (or more) byte variable?

Why don't you use EEPROM.put and EEPROM.get?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.