#include "HX711.h" // Include the HX711 library
HX711 scale; // Create an instance of the HX711 library
void setup() {
Serial.begin(9600); // Initialize serial communication
scale.begin(14, 12); // Initialize the HX711 scale with the specified data and clock pins
}
void loop() {
float startMass = scale.get_units(); // Get the initial mass reading
delay(100); // Delay for 100 milliseconds
float endMass = scale.get_units(); // Get the final mass reading after the delay
float flowRate = endMass - startMass; // Calculate the flow rate
Serial.print("Start Mass: ");
Serial.println(startMass);
Serial.print("End Mass: ");
Serial.println(endMass);
Serial.print("Flow Rate: ");
Serial.println(flowRate);
delay(1000); // Delay for 1 second before the next iteration
}