How HX711 calibration to water level.
If I only know the level. I have the code:
#include "HX711.h"
const int LOADCELL_DOUT_PIN = 23;
const int LOADCELL_SCK_PIN = 22;
float y = 100; // vyska 100 mm
HX711 scale;
void setup() {
Serial.begin(115200);
scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
}
void loop() {
if (scale.wait_ready_timeout(1000)) {
long reading = scale.read();
Serial.print("HX711 reading: ");
Serial.println(reading);
float m = reading;
float y0 = (y/m);
float y1 = (y0*m);
Serial.print("hladina: ");
Serial.println(y1);
// primka
float dy = (y-y1);
float dx = (m - reading);
float a = (dy/dx);
float b = (y1-(a*m));
float p = (a*reading+b);
Serial.print("primka: ");
Serial.println(p);
} else {
Serial.println("HX711 not found.");
}
delay(1500);
}
How should I write the first value from HX711 without load per m - write automatically?