#include "HX711.h"
// Define the GPIO pins for the HX711s
#define DOUT_PIN_1 21
#define SCK_PIN_1 22
#define DOUT_PIN_2 16
#define SCK_PIN_2 19
// Calibration factors for each HX711
float calibration_factor_1 = 1000.0; // Change this value according to your calibration
float calibration_factor_2 = 1500.0; // Change this value according to your calibration
HX711 scale_1;
HX711 scale_2;
void setup() {
Serial.begin(9600);
// Initialize the HX711s
scale_1.begin(DOUT_PIN_1, SCK_PIN_1);
scale_2.begin(DOUT_PIN_2, SCK_PIN_2);
// Set calibration factors
scale_1.set_scale(calibration_factor_1);
scale_2.set_scale(calibration_factor_2);
// Tare each scale
scale_1.tare();
scale_2.tare();
}
void loop() {
// Read the raw data from both scales
float weight_1 = scale_1.get_units();
float weight_2 = scale_2.get_units();
// Print the readings to Serial Monitor
Serial.print("Weight 1: ");
Serial.print(weight_1);
Serial.print(" grams | Weight 2: ");
Serial.print(weight_2);
Serial.println(" grams");
delay(10); // Adjust delay as needed
}