#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x3F for a 16 chars and 2 line display
#include "HX711.h"
#define calibration_factor 0.42 //This value is obtained using the SparkFun_HX711_Calibration sketch
#define LOADCELL_DOUT_PIN 2
#define LOADCELL_SCK_PIN 3
HX711 scale;
void setup() {
scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
scale.set_scale(calibration_factor); //This value is obtained by using the SparkFun_HX711_Calibration sketch
//scale.tare(); //Assuming there is no weight on the scale at start up, reset the scale to 0
lcd.init();
lcd.clear();
lcd.backlight(); // Make sure backlight is on
// Print a message on both lines of the LCD.
/*
lcd.setCursor(2,0); //Set cursor to character 2 on line 0
lcd.print("Hello world!");
lcd.setCursor(2,1); //Move cursor to character 2 on line 1
lcd.print("LCD Tutorial");
*/
}
void loop() {
//lcd.clear();
lcd.setCursor(0,0); //Set cursor to character 2 on line 0
lcd.print(String("Salt weight"));
lcd.setCursor(3,1); //Set cursor to character 2 on line 0
lcd.print(String(scale.get_units()) + "g");
}