I am following this tutorial https://www.brainy-bits.com/load-cell-and-hx711-with-arduino/
the HX711.h libraries have been updated so the test code is out of date.
I have been modifying the code to work with the new .h file
i noticed in the header file it has
void begin(byte dout, byte pd_sck, byte gain = 128);
however in the test code it is passing 2 values CLK and DOUT
I am not getting any errors per se, but the value reading is constant ( see screen shot)
I have followed the tutorial, and checked the CLK and DOUT pins with osci and they are active.
Is it because of the header file? do I need to pass something like begin(DOUT, CLK,??)
or would this be an issue with the load sensor? to mention again i have the same setup and parts as the linked tutorial
see original code in the linked tutorial
we are looking at the following lines in the code which i modified to get rid of errors:
HX711 scale; // Init of library
scale.begin(DOUT,CLK);
current code:
/* Calibration sketch for HX711 */
#include "HX711.h" // Library needed to communicate with HX711 https://github.com/bogde/HX711
//#include "HX711.cpp"
#define DOUT 6 // Arduino pin 6 connect to HX711 DOUT
#define CLK 5 // 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(20);
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);
Serial.print(F("scale factor"));// Print the scale factor to use
Serial.println(current_weight);
Serial.print(F("current weight"));
}
caliberation_sketch_for_HX711.ino (794 Bytes)
HX711.cpp (7.01 KB)
HX711.h (2.76 KB)