HX711: Storing the scale_gets_units() in a variable

Hello

Gettiing different value of a weight when capture the value in a variable the print it vs directly printed
using using lcd.print(scale.get_units(5),2)

Proper value is get using the lcd.print(scale.get_units(5),2);
the printed value is 4.2 kg This is OK

If I store the value in a variable the print it,
long weight
weight = (scale.get_units(5);
lcd.print(weight,2)
The printed value is 11 kg

What am I missing?

Martin

arjfca:
What am I missing?

A complete and properly posted (Code Tags) sketch that compiles.

gfvalvo:
A complete and properly posted (Code Tags) sketch that compiles.

By copying the code, and read it back i found the error. The "scale.get_units()" function is returning a FLOAT variable. I was declaring the variable to hold it has a Long.

Without your reply, I would had probably not yet resolved it tonight.

Martin