Comments (2)
Did you try to call scale.power_up()
after scale.begin()
?
from hx711.
@Xarbenence
I hit the same issue today, so let me explain what's likely causing yours.
First, here is the link to the datasheet - https://www.digikey.com/htmldatasheets/production/1836471/0/0/1/hx711.html
As you can see, module can provide 10 or 80 samples per second. It needs some time to provide the value after it's started, that's why your first loop always succeeds as you wait for 1 second between iterations.
Your second loop does not have any delays, so it will exit almost immediately. You must add a delay there too.
weight = scale.get_units();
// ^^^^ you read the data here, so is_ready() becomes false
...
while(i<9){
if(scale.is_ready()){ // this is_ready() always fails
long reading = scale.read();
Serial.print("HX711 reading: ");
Serial.println(reading);
break;
} else {
delay(100);
// ^^^^ here
}
As I can see from the sources, begin()
does not perform communication with the module, so it's not something that helps you here, but rather the delay at the end of the script, or something else.
I had and identical issue cause by power_up
and power_down
- I called power_up and expected data was available immediately. That was obviously wrong, so after I added some delay (just hardcoded 500ms to comply with Output settling time, however there are better APIs of achieving that, have a look at wait_ready_timeout
and wait_ready_retry
) everything got back to normal.
PS. I'd greatly appreciate if you edit your post, use github's markdown to make it look like a code and clean it up from commented code.
from hx711.
Related Issues (20)
- Arduino 2 support
- Formula to find hx711 output of load cell voltage output HOT 1
- Arduino MKR 1010 Upload failure
- Arduino freezes after about 1 hour of continuous reading
- serial monitor freezes on arduino uno when data or clock from HX711 is connected to the arduino digital data pin
- Should function "scale.tare();" need a parameter? HOT 2
- add NRF to compatible boards list
- Verify my wiring (HX711 with four strain gauges) HOT 2
- Multiple HX711 with one clock HOT 1
- warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
- Reason behind using D2 and D3 pins HOT 1
- How to check load cell is connected or not
- What are possible values for scale.set_scale(2280.f); HOT 2
- 71
- self-calibration of load cell
- HX711 not thread safe?
- HX711 high current consumption
- Error on `make build-all` HOT 1
- 2 (or more) mass calibration
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hx711.