Skip to content

Commit bb97935

Browse files
committed
1.2.10
1 parent e1bc08a commit bb97935

File tree

10 files changed

+21
-4
lines changed

10 files changed

+21
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Latest release and change log here: https://github.com/olkal/HX711_ADC/releases
22

33
This an Arduino library for the HX711 24-bit ADC for weight scales.
4-
Data retrieval from the HX711 is done without halting the mcu, also on the 10SPS rate setting and with Multiple HX711's performing conversions simultaneously.
5-
Tare function can also be performed without halting the mcu.
4+
Data retrieval from the HX711 is done without blocking the mcu, also on the 10SPS rate setting and with Multiple HX711's performing conversions simultaneously.
5+
Tare function can also be performed without blocking the mcu.
66

77
Filtering and smoothing: "Moving average" method from a rolling data set combined with removal of high/low outliers is used for the retrieved value.
88

examples/Calibration/Calibration.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ void setup() {
3939
Serial.println("Starting...");
4040

4141
LoadCell.begin();
42+
//LoadCell.setReverseVal(); //uncomment to turn a negative output value to positive
4243
unsigned long stabilizingtime = 2000; // preciscion right after power-up can be improved by adding a few seconds of stabilizing time
4344
boolean _tare = true; //set this to false if you don't want tare to be performed in the next step
4445
LoadCell.start(stabilizingtime, _tare);

examples/Persistent_zero_offset/Persistent_zero_offset.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ void setup() {
4141
Serial.println("Starting...");
4242

4343
LoadCell.begin();
44+
//LoadCell.setReverseVal(); //uncomment to turn a negative output value to positive
4445
float calibrationValue; // calibration value (see example file "Calibration.ino")
4546
calibrationValue = 696.0; // uncomment this if you want to set the calibration value in the sketch
4647

examples/Read_1x_load_cell/Read_1x_load_cell.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ void setup() {
3939
Serial.println("Starting...");
4040

4141
LoadCell.begin();
42+
//LoadCell.setReverseVal(); //uncomment to turn a negative output value to positive
4243
float calibrationValue; // calibration value (see example file "Calibration.ino")
4344
calibrationValue = 696.0; // uncomment this if you want to set the calibration value in the sketch
4445
#if defined(ESP8266)|| defined(ESP32)

examples/Read_2x_load_cell/Read_2x_load_cell.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ void setup() {
4545

4646
LoadCell_1.begin();
4747
LoadCell_2.begin();
48+
//LoadCell_1.setReverseVal(); //uncomment to turn a negative output value to positive
49+
//LoadCell_2.setReverseVal(); //uncomment to turn a negative output value to positive
4850
unsigned long stabilizingtime = 2000; // tare preciscion can be improved by adding a few seconds of stabilizing time
4951
boolean _tare = true; //set this to false if you don't want tare to be performed in the next step
5052
byte loadcell_1_rdy = 0;

examples/Testing/Testing.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ void setup() {
4646
//EEPROM.get(calVal_eepromAdress, calibrationValue); // uncomment this if you want to fetch this value from eeprom
4747

4848
LoadCell.begin();
49+
//LoadCell.setReverseVal(); //uncomment to turn a negative output value to positive
4950
unsigned long stabilizingtime = 2000; // tare preciscion can be improved by adding a few seconds of stabilizing time
5051
boolean _tare = true; //set this to false if you don't want tare to be performed in the next step
5152
LoadCell.start(stabilizingtime, _tare);

keywords.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ refreshDataSet KEYWORD2
4040
getDataSetStatus KEYWORD2
4141
getNewCalibration KEYWORD2
4242
getSignalTimeoutFlag KEYWORD2
43-
43+
setReverseVal KEYWORD2
4444

4545

4646
#######################################

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=HX711_ADC
2-
version=1.2.9
2+
version=1.2.10
33
author=Olav Kallhovd
44
maintainer=Olav Kallhovd
55
sentence=Library for the HX711 24-bit ADC for weight scales.

src/HX711_ADC.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,9 @@ void HX711_ADC::conversion24bit() //read 24 bit data, store in dataset and star
322322
dataOutOfRange = 1;
323323
//Serial.println("dataOutOfRange");
324324
}
325+
if (reverseVal) {
326+
data = 0xFFFFFF - data;
327+
}
325328
if (readIndex == samplesInUse + IGN_HIGH_SAMPLE + IGN_LOW_SAMPLE - 1)
326329
{
327330
readIndex = 0;
@@ -505,3 +508,9 @@ bool HX711_ADC::getSignalTimeoutFlag()
505508
{
506509
return signalTimeoutFlag;
507510
}
511+
512+
//reverse the output value (flip positive/negative value)
513+
//tare/zero-offset must be re-set after calling this.
514+
void HX711_ADC::setReverseVal() {
515+
reverseVal = true;
516+
}

src/HX711_ADC.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ class HX711_ADC
8282
bool getDataSetStatus(); //returns 'true' when the whole dataset has been filled up with conversions, i.e. after a reset/restart
8383
float getNewCalibration(float known_mass); //returns and sets a new calibration value (calFactor) based on a known mass input
8484
bool getSignalTimeoutFlag(); //returns 'true' if it takes longer time then 'SIGNAL_TIMEOUT' for the dout pin to go low after a new conversion is started
85+
void setReverseVal(); //reverse the output value
8586

8687
protected:
8788
void conversion24bit(); //if conversion is ready: returns 24 bit data and starts the next conversion
@@ -114,6 +115,7 @@ class HX711_ADC
114115
bool dataOutOfRange = 0;
115116
unsigned long lastDoutLowTime = 0;
116117
bool signalTimeoutFlag = 0;
118+
bool reverseVal = 0;
117119
};
118120

119121
#endif

0 commit comments

Comments
 (0)