#include "HX711.h"
// Define the pins connected to the HX711
const int LoadCellDoutPin = A1;
const int LoadCellSckPin = A0;
HX711 scale;
void setup() {
Serial.begin(9600);
scale.begin(LoadCellDoutPin, LoadCellSckPin);
}
void loop() {
if (scale.is_ready()) {
long weight = scale.get_units(); // Get weight in grams
Serial.print("Weight: ");
Serial.print(weight*100/42);
Serial.println(" grams");
} else {
Serial.println("Error: Unable to detect HX711. Please check your connections.");
}
delay(1000); // Delay for one second (adjust as needed)
}