Hello,im using the library hx711.h master (04/12/2021)
and my code for getting weight
weight = scale.get_units(), 3;
is there any code or library that can cut off some extreme values showing sometimes?
Hello,im using the library hx711.h master (04/12/2021)
and my code for getting weight
weight = scale.get_units(), 3;
is there any code or library that can cut off some extreme values showing sometimes?
How about ignoring extreme, illogical values?
I would guess that sometimes occurring extreme values
are caused by environment, hardware, setup, or wiring.
Considering that this code will always assign 3 to the weight, it doesn't seem too extreme.
How can i ignore this values?
if (valueIsNotExtreme) {
// use value
}
Number 3 is the number of decades,eg 1.001, some times there are suddenly values like 9.000 with no weight on.On the same board there is a gsm 900 modem
Thank you for your answer,but extreme readings are not predefined, its a weight scale and weight is not known before
So your question does not really make sense,
if you can not define what the above extreme means.
Perhaps not in the code you posted:
It could end up acting like a Comma Operator.
This is actually working after comma if i put 2 i have two decades eg. 1.00
Not in the minimum of code you posted.
The , 3 is simply ignored.
struct Dummy {
float get_units() {
return 2.34;
}
} scale;
void setup() {
Serial.begin(115200);
float weight;
weight = scale.get_units(), 3;
Serial.print(F("float weight = "));
Serial.println(weight);
}
void loop() {}
float weight = 2.34
Somewhere\KommaOperator\KommaOperator.ino: In function 'void setup()':
Somewhere\KommaOperator\KommaOperator.ino:10:32: warning: right operand of comma operator has no effect [-Wunused-value]
weight = scale.get_units(), 3;
^
Im using library hx711.h
That does not matter.
I give up.
Good luck with your project.
That raises questions about powering the board.
A GSM modum could draw up to 2Amp during transmit.
Serial.println(weight ,3); // print with three decimal places
Leo..
Hi,
Can you please post your complete code?
Have you tried the example code that comes with the library, to prove that your hardware communication is stable?
Can we please have a circuit diagram?
An image of a hand drawn schematic will be fine, include ALL power supplies, component names and pin labels.
How are you powering your project?
Thanks.. Tom..
![]()
You are mistaken. Your code can't works this way.
The syntax like (x, 3) actually works in the print() operator ONLY, but not anywhere in the C code.
Please show whole code.
powering the board was one of my first problems...it is solved, 18650 battery and volage booster at 5.2v,
you are right about
Serial.println(weight ,3); // print with three decimal places
this is what im using on sending sms.
is there a way that i can take eg. 10 readings and delete the one that is way a lot above other nine?
weight = scale.get_units(10);
you are right about
Serial.println(weight ,3); // print with three decimal places
this is what im using on sending sms.