olkal / HX711_ADC

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

Can we disable tare? #30

Closed nayanashettyft closed 5 years ago

nayanashettyft commented 5 years ago

I have a simple code to setup and read the data from the load cell. However when I start the scale with load on it, it starts at 0 rather than the initial weight of the object on it. Is there a way to disable the tare() so it gets the actual weight on the loadcell even at the start point?

Code I have:

HX711_ADC LoadCell(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
void setup() {
  LoadCell.begin(); // start connection to HX711
  LoadCell.start(2000); // load cells gets 2000ms of time to stabilize
  LoadCell.setCalFactor(200.0); // calibration factor for load cell
}
void loop(){
  LoadCell.update(); // retrieves data from the load cell
  long reading = LoadCell.getData(); // get output value
  Serial.print("HX711 reading: ");
  Serial.println(reading);
}
olkal commented 5 years ago

Hi Yes, you can remove the "LoadCell.start" function in the setup part of your scetch, then tare will not be performed when you power up (#28).

nayanashettyft commented 5 years ago

Hi thanks for the quick response, I tried this out yesterday and this fixed the issue for me.