#include <HX711_ADC.h>
const int HX711_dout = 2;
const int HX711_sck = 3;
HX711_ADC LoadCell(HX711_dout, HX711_sck);
void setup() {
Serial.begin(9600);
// put your setup code here, to run once:
LoadCell.begin();
float calibrationValue; // calibration value (see example file "Calibration.ino")
calibrationValue = 44.0; // uncomment this if you want to set the calibration value in the sketch
unsigned long stabilizingtime = 2000; // preciscion right after power-up can be improved by adding a few seconds of stabilizing time
boolean _tare = true; //set this to false if you don't want tare to be performed in the next step
LoadCell.start(stabilizingtime, _tare);
if (LoadCell.getTareTimeoutFlag()) {
Serial.println("Timeout, check MCU>HX711 wiring and pin designations");
while (1)
;
} else {
LoadCell.setCalFactor(calibrationValue); // set calibration value (float)
Serial.println("Startup is complete");
}
Serial.println("Initialized load cell amplifier");
}
void loop() {
if (LoadCell.update()) {
float lcreading = LoadCell.getData();
Serial.println(lcreading);
delay(100);
}
}