I've been following this tutorial on how to calibrate the HX711: https://www.brainy-bits.com/load-cell-and-hx711-with-arduino/
However, the HX711.h libraries have been updated hence the test script is having issues.
I have worked through the errors line by line however I cannot get past this error:
Arduino: 1.8.11 (Mac OS X), Board: "Arduino Uno"
the .h and .cpp files are included in the same folder. I have also attached all source codes.
The error doesn't make sense. I have tried moving the defining outside the loop but nope
error is:
undefined reference to `get_units()'
the modified code:
/* Calibration sketch for HX711 */
#include "HX711.h" // Library needed to communicate with HX711 https://github.com/bogde/HX711
//#include "HX711.cpp"
#define DOUT 5 // Arduino pin 6 connect to HX711 DOUT
#define CLK 4 // Arduino pin 5 connect to HX711 CLK
HX711 scale(); // Init of library
void setup() {
Serial.begin(9600);
//scale.begin(DOUT,CLK);
void set_scale(); // Start scale
void tare(); // Reset scale to zero
}
void loop() {
float get_units();
float current_weight;
current_weight=get_units();
float scale_factor=(current_weight/0.145); // divide the result by a known weight
Serial.println(scale_factor); // Print the scale factor to use
}
caliberation_sketch_for_HX711.ino (695 Bytes)
HX711.cpp (7.01 KB)
HX711.h (2.76 KB)