#include <HX711.h>
#define DATA_PIN 15
#define CLOCK_PIN 2
HX711 hx711;
long units;
int buzzer = 13;
void setup() {
Serial.begin(115200);
hx711.begin(DATA_PIN, CLOCK_PIN);
hx711.set_scale(420.0983);
hx711.tare();
pinMode(buzzer, OUTPUT);
}
//String normal="normal";
// int overload="overload";
int n=0;
int i;
void loop()
{
units = hx711.get_units();
int v=map(units,0,50,0,3500);
// Serial.println(units);
if(v>2500)
{
i=-1;
//Serial.println(units);
tone(buzzer, 1000);
n=1;
//delay(1000);
}
else if(v<500)
{
i=0;
noTone(buzzer);
n=2;
}
else
{
i=v;
//ThingSpeak.setField(1,units);
noTone(buzzer);
n=2;
}
delay(15000);
}