I want to connect 2 scales to a single Autonomo. The existing single setup uses an HX711 amplifier and the code includes the HX711.h library.
Hardware is easy as I will connect 2 HX711 amplifiers to different digital pins using the Grove shield.
In the initialisation section, it makes a definition:-
HX711 scale(DOUT, CLK);
which tells it which pins the HX711 is on.
Then in the setup section it sets the calibration and zero parameters:-
Then in the main loop it actually makes the call to the scale:-
url += String(LABEL_DATA_SEP) + String(scale.get_units());
I’m not sure which is the best way to tackle this.
One way is to put all of the set up parameters into the main loop with 2 branch loops - so you redefine everything each time (seems this might be slow to execute).
Another is to make a copy of the HX711.h library, call it something different and set both up with the different parameters during initialisation and setup. Then call one or other library in turn to take readings (this looks a pedestrian but effective approach).
The third way is to work out how to pass multiple parameters to the single HX711.h library each time (I think this requires editing the .h and .cpp libraries which is a bit scary!).
Once I’ve got the readings, straightforward to combine in the URL string.