How to multiply scale value by a set number?

Hello, newb here, thanks in advance. I want to know on a scale using a 4 wire load sensor and the HX711 amplifier board, how can I tell Arduino Uno to multiply whatever the scale reading is by 2477. So if I put on a 10 lb weight I want it to read 24770 on my led display. I just need it to multiply whatever the weight is by 2477. I added the HX711 library and was hoping there was a way to add a line of code to it for this function. Thank you!

Try multiplication. You must have learned enough to use addition, subtraction, multiplication and so forth with variables.

Srsly, what is your question?

// up top a constant, that "set number"
const float setNumber  = 2477.0;


// later in your code

  myDesiredValue = get_units() * setNumber;


I feel like I must be missing something.

I looked at the library, you could also call set_scale() and then get_units() would returned the value scaled already.

		// set the SCALE value; this value is used to convert the raw data to "human readable" data (measure units)
		void set_scale(float scale = 1.f);

So just

  set_scale(2477.0);

in you setup() function.

a7

No don't even think about that. You want to use the library as you find it, that's the hole idea of using a library.

Until you aren't a noob, and possibly for decades since.

Besides which that library already affords you the means to do what you want.

a7

Well it is probably me missing stuff, since I have approx 2 hours experience with Arduino. Yes, I think what you answered was basically what I was asking for. I just need my the displayed led readout to be whatever weight is placed on the scale to be multiplied by 2477 and displayed on the display. So if 38 Lbs is placed on the scale then I need the readout to be 94126

So you should take 10 minutes to carefully read

and there are complete ready to use demo-codes for taring and scaling

best regards Stefan

Thanks!!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.