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

scale.get_max #21

Closed
cgdavis007 opened this issue Dec 24, 2015 · 3 comments
Closed

scale.get_max #21

cgdavis007 opened this issue Dec 24, 2015 · 3 comments

Comments

@cgdavis007
Copy link

Very handy library. It works well with lcd.print and I've tried modifying my sketch to achieve my desired goal, but I'm not a code guy so what I'm asking may not be possible. Would it be difficult to add this to your library? It would be nice to apply a force to the load cell and watch the numbers climb, stopping at the highest force applied. This would be useful for a load force tester.

Many Thanks,
Chuck

@bogde
Copy link
Owner

bogde commented Dec 25, 2015

if i understand your requirements correctly, you just need to store and print the max value in your code. something like this:

...
value = 0;
temp = scale.get_value();
if (temp > value)
{
    value = temp;
    ...
    lcd.print(value);
}
...

@cgdavis007
Copy link
Author

Your understanding is correct. I've tried if and for statements and even while loops. I integrated your suggestion into my code but the value returned is not in units and varies from reset to reset with no change once weight/force is applied to the load cell. Do you have any other suggestions? Thanks in advance.

@bogde
Copy link
Owner

bogde commented Dec 28, 2015

you can use get_units instead of get_value. the max value you're storing in value won't survive a reset unless you save it somewhere in the eeprom (see https://www.arduino.cc/en/Reference/EEPROM).

@bogde bogde closed this as completed Dec 31, 2015
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

2 participants