Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library HX711 #10

Closed
vejo17 opened this issue Sep 8, 2014 · 7 comments
Closed

Library HX711 #10

vejo17 opened this issue Sep 8, 2014 · 7 comments

Comments

@vejo17
Copy link

vejo17 commented Sep 8, 2014

Hi Good night i have problem with the code that you use when i try to upload the code, the program send me this message sketch_sep07a:6: error: 'Hx711' does not name a type
sketch_sep07a.ino: In function 'void setup()':
sketch_sep07a:11: error: 'scale' was not declared in this scope
sketch_sep07a.ino: In function 'void loop()':
sketch_sep07a:16: error: 'scale' was not declared in this scope
And i already uploaded the library that you put in web page

I hope can you help me with this issue.

Thanks.
Regards

@bogde
Copy link
Owner

bogde commented Sep 8, 2014

do you have:

#include "HX711.h"

at the top of your sketch file?

are you using
Hx711 scale(A1, A0);
or
HX711 scale(A1, A0);
?

use HX711 scale(A1, A0);

does the included example (HX711Serial) work?

@vejo17
Copy link
Author

vejo17 commented Sep 9, 2014

Hi
I use HX711 scale(A1, A0), but the program send me the next message:sketch_sep08b.ino: In function 'void loop()':sketch_sep08b:12: error: 'class HX711' has no member named 'getGram'.The example (HX711Serial) is working correctly.
Im using this code:#include <HX711.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);HX711 scale(A1, A0);void setup() {lcd.begin(16, 2);}void loop() {lcd.setCursor(0, 0);lcd.print(scale.getGram(), 1);lcd.print(" g");lcd.print(" ");delay(200);} but in the blue line im having a mistake. Can you tell me how to resolve this issue ? Or if i have to use another function?
And thanks for your answer
Date: Sun, 7 Sep 2014 22:30:27 -0700
From: notifications@github.com
To: HX711@noreply.github.com
CC: lavadero_jorge@hotmail.com
Subject: Re: [HX711] Library HX711 (#10)

do you have:

#include "HX711.h"

at the top of your sketch file?

are you using

Hx711 scale(A1, A0);

or

HX711 scale(A1, A0);

?

use HX711 scale(A1, A0);

does the included example (HX711Serial) work?


Reply to this email directly or view it on GitHub. =

@bogde
Copy link
Owner

bogde commented Sep 9, 2014

there is no method getGram. see here for the methods you can call:
https://github.com/bogde/HX711/blob/master/HX711.h

see the example for a proper usage.

@bogde bogde closed this as completed Sep 9, 2014
@r-a-i
Copy link
Contributor

r-a-i commented Aug 17, 2019

I ran into this issue too.

The documentation on ./README.md says that in the non-blocking mode we should:

// 4. Acquire reading without blocking
if (scale.wait_ready_timeout(1000)) {...

Instead, it should say:

// 4. Acquire reading without blocking
if (loadcell.wait_ready_timeout(1000)) {...

for consistency with the definition at the start of the example
HX711 loadcell;

@amotl
Copy link
Contributor

amotl commented Aug 17, 2019

Dear @r-a-i,

may I humbly ask for a pointer where you found this inconsistency? I just skimmed [1] and can't find any typo in there.

With kind regards,
Andreas.

[1] https://github.com/bogde/HX711/tree/master/examples

@amotl
Copy link
Contributor

amotl commented Aug 17, 2019

may I humbly ask for a pointer

Reading things more concentrated always makes sense. Sorry again for overlooking your reference to README.md.

You are absolutely right. When fixing this, we might also think about making the example in README.md consistent with the example files referenced above, right?

Would you personally prefer scale oder loadcell as the name for a canonical variable name referencing the HX711 object? Technically, just calling it hx711 would also be fine but might confuse newcomers.

... just wanted to mention that I acknowledge we should bring more consistency into the code examples and that I am personally open for any better name if desired.

@r-a-i
Copy link
Contributor

r-a-i commented Aug 18, 2019

Dear @amotl, I just submitted a pull request for this change for your consideration.

Personally, I think the variable name "loadcell" is more generic as the "Hx711" is a loadcell amplifier. Some people may use loadcells to build "scales", but not always. In my case, I'm using a loadcell to measure a force directly and not weight.

Thank you for your consideration and all your contributions to this library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants