Hey friends
I use the EEPROM library to insert data into the non-volatile memory.
The value variable contains data from 1 to 20.
When I insert a number higher than 10 and then save a number smaller than 10 again, ie a number with one digit, the EEPROM memory stores the second digit of the previous number, i.e. if I entered 8 the second time instead of getting 08 I will get 80, I tried to enter 0 Before the number but as everyone knows that 0 is nothing .... and only a number higher than 1 will be kept.
I tried it does not help.
The length of an int can be either one bit if it is one digit or two bits if it is two numbers.
The storage is done well, the problem is that it does not add 0 if it is only one number, what it does is keep the number in the first bit and the second bit stays with the previous memory, so I have to save the memory a value of 0 for the first house and the number value for the second house.
Hey, hey, hey.
I really appreciate it...
Why do you think differently ???
(Maybe my English is not the best, and yes I can not pronounce myself correctly).
Overall I say I updated my code as shown below, and it still retains the previous memory.
So I wonder where I went wrong.
#include <EEPROM.h>
void setup() {
Serial.begin(9600);
}
void loop() {
int Value = analogRead(A0); //Pin X-axis of joystick module
if(Value < 21){
EEPROM.put(0, Value);
}
}
I used get
And I went through the documentation twice.
However the update of number one does not apply to the other
I update it at number 19 and then update again at number 4, my output is 49.