0

i want to apply formula. but getting 0 at output.

#include "HX711.h"
int data;
HX711 scale(A1, A0);		// parameter "gain" is ommited; the default value 128 is used by the library
void setup() {
 Serial.begin(38400);
 scale.set_scale(2280.f);         
 scale.tare();				   
}
void loop() {
 Serial.print("one reading:\t");
 data==(scale.get_units()/10);
 Serial.println(data);
		    // put the ADC in sleep mode
 delay(500);
}
asked Aug 16, 2019 at 11:57
1
  • why do you have == in data==(scale.get_units()/10);? Commented Aug 16, 2019 at 13:13

1 Answer 1

2

It's zero because you never assign it a value.

Here you are comparing the current value of data (0) with the results of your calculation:

data==(scale.get_units()/10);

I think you intended to use the assignment, not comparison, operator =:

data = (scale.get_units()/10);
answered Aug 16, 2019 at 12:06

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.