#include <LiquidCrystal_I2C.h> //library untuk lcd
#include "HX711.h" // library untuk loadcell
#define I2C_ADDR 0x27
#define LCD_COLUMNS 20
#define LCD_LINES 4
#define DOUT 2
#define CLK 3
#define calibration_factor 421.45
HX711 scale;
LiquidCrystal_I2C lcd(I2C_ADDR, LCD_COLUMNS, LCD_LINES);
float GRAM;
void setup() {
//Serial.begin(9600);
scale.begin(DOUT, CLK);
scale.set_scale(calibration_factor);
scale.tare();
lcd.init();
}
void loop() {
scale.set_scale(calibration_factor);
GRAM = scale.get_units(), 4;
if (GRAM > 1 ) {
GRAM = scale.get_units() + 0.01, 4;
}
if (GRAM > 4 ) {
GRAM = scale.get_units() + 0.015, 4;
}
//Serial.println(GRAM);
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("SCITOLOUS KEL 4");
lcd.setCursor(0, 1);
lcd.print("Massa:");
lcd.setCursor(7, 1);
lcd.print(GRAM);
lcd.setCursor(12, 1);
lcd.print("gram");
delay(100);
}