#include "HX711.h"
HX711 scale;
int weight_aim = 3000;
int output_LED = 8;
void setup() {
// put your setup code here, to run once:
pinMode(output_LED, OUTPUT);
Serial.begin(115200);
scale.begin(A1, A0);
scale.tare();
}
void loop() {
// put your main code here, to run repeatedly:
float Gewicht = measure_weight();
Serial.println (Gewicht);
if (Gewicht < weight_aim) {
powerLED(8);
}
else {
stopLED(8);
}
}
int powerLED(int pin) {
digitalWrite(pin, HIGH);
}
int stopLED(int pin) {
digitalWrite(pin, LOW);
}
float measure_weight() {
float weight;
weight = scale.get_value() * 5000/2100;
//Serial.println(weight);
return weight;
delay(1000);
}