Load cell auto tares on restart

#include <HX711_ADC.h> 
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
HX711_ADC LoadCell(4, 5);
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); 
void setup() {
  LoadCell.begin(); // start connection to HX711
  LoadCell.start(2000); // load cells gets 2000ms of time to stabilize
  LoadCell.setCalFactor(999.0); // calibration factor for load cell => strongly dependent on your individual setup
  lcd.begin(16, 2); // begins connection to the LCD module
  lcd.backlight(); // turns on the backlight
}
void loop() {
  LoadCell.update(); // retrieves data from the load cell
  float i = LoadCell.getData(); // get output value
  lcd.setCursor(0, 0); // set cursor to first row
  lcd.print("Weight[g]:"); // print out to LCD
  lcd.setCursor(0, 1); // set cursor to secon row
  lcd.print(i); // print out the retrieved value to the second row
}

How do I change this program to store the value of i in the EEPROM so that my program does not reset to zero even though the weight is still on the load cell when I turn off the power supply?

Thank you in advance.

1 Like

When and how often do you want to write the value to the EEPROM ?

UKHeliBob:
When and how often do you want to write the value to the EEPROM ?

I just want the weighing scale to not reset to zero when I cut the power supply. So not very often.