#include "HX711.h"
#define LOADCELL_DOUT_PIN 26
#define LOADCELL_SCK_PIN 27
#define LED_PIN 5
HX711 scale;
void setup() {
Serial.begin(115200);
scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
pinMode(LED_PIN, OUTPUT);
scale.set_scale(5000.00); // Adjust this value based on calibration
scale.tare(); // Reset the scale to 0
}
void loop() {
float weight = scale.get_units(10);
Serial.print("Weight: ");
Serial.println(weight);
if (weight > 5) { // Example threshold, adjust accordingly
digitalWrite(LED_PIN, HIGH); // Turn on LED if weight exceeds threshold
delay(100);
digitalWrite(LED_PIN, LOW);
delay(100);
} else {
digitalWrite(LED_PIN, LOW); // Turn off LED
}
delay(1000); // Delay for stability
}