I apologize for 'banging on' about this, but I've tried may examples of this subject and don't seem to be getting anywhere.
From examples in the Arduino IDE I have copied and amended the following code. It seems simple even to me but there's a big problem with it. Each time its run I get a different result!
Can anyone tell me why please?
What I'm trying to do is weigh a flower pot filled with absorbant material in the dry state (tare) and in the wet state (set_scale) The intention is to produce a maximum scale figure of 100 (to use as a 'percentage' rather than a weight.
#include "HX711.h"
#define DOUT 11
#define CLK 12
byte yesPin=0;
HX711 scale(DOUT, CLK);
float calibration_factor = 7050; //-7050 worked for my 440lb max scale setup
//================================================================
void setup() {
Serial.begin(9600);
scale.set_scale();
scale.tare();
}
//================================================================
void loop() {
Serial.println("Place weight 1 ");
delay(10000);
scale.tare();
Serial.println("Place weight 2 ");
delay(10000);
scale.set_scale(calibration_factor); //Adjust to this calibration factor
Serial.print("Reading: ");
Serial.print(scale.get_units(), 1);
delay(400);
//Serial.print(" lbs"); //Change this to kg and re-adjust the calibration factor if you follow SI units like a sane person
Serial.print(" calibration_factor: ");
Serial.print(calibration_factor);
Serial.println();
while(yesPin==0){}
}