/* an arduino program for 1kg Load Cell with HX711 Amplifier
that measures weight continuously and shown in I2C 16x2 LCD panel.
This program uses the Wire library to communicate with the I2C bus,
the HX711 library to interface with the load cell and amplifier,
and the LiquidCrystal_I2C library to control the LCD display.
In the setup function, the LCD and load cell are initialized, and the load cell is tared to zero the weight.
In the loop function, the weight is continuously read and displayed on the LCD display in kilograms.
Note that the program assume the Load cell is connected to pin A3 and A2 of arduino, you may need to adjust the pin numbers accordingly.
*/
#include <Wire.h>
#include <HX711.h>
#include <LiquidCrystal_I2C.h>
HX711 scale;
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
lcd.begin();
lcd.backlight();
scale.begin(A3, A2);
scale.set_scale();
scale.tare();
}
void loop() {
float weight = scale.get_units();
lcd.clear();
lcd.print("Weight: ");
lcd.print(weight);
lcd.print(" kg");
delay(1000);
}
No comments:
Post a Comment