temporarily saving and overwriting variables

Hello, my project is a motivation- scale. It's supposed to memorize your weight and, if you step on it again, indaticate (via LEDs) if you gained/lost weight.

My problem at the moment is, that I don't know how to memozing the weight for just the last time you stood on it and how to overwrite it everytime, without making it equal to my current weight.

Please let me know, if you can help me, with this issue, thanks!:)

You can write a weight to EEPROM. https://www.arduino.cc/en/Reference/EEPROM

.

In general you need two variables, one for the current weight (curWeight), and one for the previous one (prevWeight). Before you take a new value, you copy the (old) current value to the previous weight variable, then update the current weight.

prevWeight = curWeight;
curWeight = analogRead(pin);
Serial.print(curWeight-prevWeight); //show difference

If you want to preserve the values during power off, you can write both values (at least the last reading in curWeight) to EEPROM before turning power off, and copy these values in setup() back into the variables, at power on.