#include "HX711.h"
#include <Servo.h>
Servo myservo;
HX711 scale;
#define servoPin 9
#define loadcell (A1, A0)
int angle = 0;
int threshold = 2000;
int thresholdHIGH = 4000;
void setup() {
Serial.begin(9600);
myservo.attach(servoPin);
pinMode(servoPin, OUTPUT);
pinMode(loadcell,INPUT);
Serial.println("Initializing the scale");
scale.begin(A1, A0);
}
void loop() {
Serial.println(scale.get_units()*2.380952, 1);
int force = scale.get_units();
float Grams = (force*2.380952);
if (thresholdHIGH>Grams && Grams>threshold) {
myservo.write(90);
}
else {
myservo.write(0);
}
delay(700);
}