olkal / HX711_ADC

Arduino library for the HX711 24-bit ADC for weight scales
MIT License
235 stars 124 forks source link

Stuck in endless while loop startmultiple() with _tare set to false #57

Closed pvakharwala closed 3 years ago

pvakharwala commented 3 years ago

I am trying to get data from 2 load cells but the startmultiple function returns some arbitrary value when _tare is set to false how shall I combat that? Also the while loop runs endlessly if I use the 2x load cell example. Please help

olkal commented 3 years ago

Hi!

If you set tare false in startmultiple function, the tare offset avlue will not be set and the output value without load will not be zero (it will be some number very far from zero). If you don't wish to let the startmultiple function calculate and set the tare offset, you can do it later in the loop, see example file, "send 't' from serial terminal", line no 87 in the 2x load cell example.

The endless loop issue under discribed circumstances has now been fixed in 1.2.6, thanks.

pvakharwala commented 3 years ago

Hi!

If you set tare false in startmultiple function, the tare offset avlue will not be set and the output value without load will not be zero (it will be some number very far from zero). If you don't wish to let the startmultiple function calculate and set the tare offset, you can do it later in the loop, see example file, "send 't' from serial terminal", line no 87 in the 2x load cell example.

The endless loop issue under discribed circumstances has now been fixed in 1.2.6, thanks.

How can I set it manually like apply that offset value. Basically what is happening is I calibrate my sensor using the calibration sketch then I load my code and when it runs there is some value other than zero as you described. So will that value be same everytime the sensors and board powers on? And how shall I get that value and store it and use it in my code?

olkal commented 3 years ago

Yes the output value will be aprox. the same ea time you start, but be aware that it may change a bit by temperature etc. If you want to manually apply the zero offset value you first need to obtain the value like this:

You can now use this value to manually set the zero offset in your sketch: loadcell.setTareOffset(zero_offset_val)

olkal commented 3 years ago

I’m closing this issue because it has been inactive for some time. Please reopen if you still encounter this issue with the latest version, or if the postings in this thread don't solve your problem . Thank you!