Skip to content

Commit

Permalink
1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
olkal committed Jun 16, 2018
1 parent eb66f7e commit 79fa34e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ Hardware and ADC noise:
Wires between HX711 and load cell should be twisted and kept as short as possible.
Most available HX711 modules seems to follow the reference design, but be aware that some modules are poorly designed with under-sized capacitors, and noisy readings.
The Sparkfun module seems to differ from most other available modules as it has some additional components for noise reduction.


Update 1.0.2:
- Implemented requested function setTareOffset(long newoffset)
- Initializing of the index counter in the class declaration: readIndex = 0
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=HX711_ADC
version=1.0.1
version=1.0.2
author=Olav Kallhovd
maintainer=Olav Kallhovd
sentence=Arduino library for the HX711 24-bit ADC for weight scales
Expand Down
6 changes: 6 additions & 0 deletions src/HX711_ADC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,17 @@ void HX711_ADC::powerUp()
digitalWrite(sckPin, LOW);
}

//get the tare offset (raw data value output without the scale "CalFactor")
long HX711_ADC::getTareOffset()
{
return tareOffset;
}

//set new tare offset (raw data value input without the scale "CalFactor")
void HX711_ADC::setTareOffset(long newoffset)
{
tareOffset = newoffset;
}

//for testing only:
//if ready: returns 24 bit data and starts the next conversion, else returns -1
Expand Down
3 changes: 2 additions & 1 deletion src/HX711_ADC.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class HX711_ADC
void powerUp();
bool getTareStatus(); // returns 1 if tareNoDelay() operation is complete
long getTareOffset();
void setTareOffset(long newoffset);
uint8_t update(); //if conversion is ready; read out 24 bit data and add to data set

protected:
Expand All @@ -66,7 +67,7 @@ class HX711_ADC
float calFactor;
long dataSampleSet[DATA_SET + 1]; // data set, make voltile if interrupt is used
long tareOffset;
int readIndex;
int readIndex = 0;
long timeStamp;
uint8_t isFirst = 1;
uint8_t tareTimes;
Expand Down

0 comments on commit 79fa34e

Please sign in to comment.