0

Error reading

Hi Guys! i have a problem with the reading with my NODEMCU where i tried this code on an arduino UNO it is working perfectly fine but until i tried to switch it to NODEMCU 1.0 which have a wifi function that i need, the reading turn out to have this type of error, i've tried looking for solution online and tried every single of them but apparently none of it help. The image is the error i have faced and the connection i have made from the nodemcu to hx711 is VCC --> Vin or 3.3v, GND --> GND, DT --> D2, SCK --> D3. Here's the code that i found online to use:

#include <HX711.h>

// Scale Settings
const int SCALE_DOUT_PIN = D2;
const int SCALE_SCK_PIN = D3;

HX711 scale(SCALE_DOUT_PIN, SCALE_SCK_PIN);

void setup() {
  Serial.begin(115200);
  scale.set_scale(-47740);// <- set here calibration factor!!!
  scale.tare();
}

void loop() {
  float weight = scale.get_units(1);
  Serial.println(String(weight, 3));
}

Thanks in advance!!

5
  • Putting your whole code in comments is not helpful. I edited your post this time, remember to select code and then ctrl+k
    – MichaelT
    Commented Oct 29, 2018 at 9:59
  • Sorry about that, would keep in mind about it! Appreciate your help thanks!
    – Kelvin
    Commented Oct 29, 2018 at 10:04
  • try D1 instead of D3. D3 is io 0, a boot configuration pin
    – Juraj
    Commented Oct 29, 2018 at 10:24
  • Hi juraj! Thanks for the reply. i tried D1 and the Serial monitor now shows a reading of 0.000 all the way regardless of the weight i put on it.
    – Kelvin
    Commented Oct 30, 2018 at 4:23
  • Hi juraj, i have change the VCC connection from Vin to 3.3v and it work! thanks!! could you post your answer on the answer section so i could upvote? thanks for the help!!
    – Kelvin
    Commented Oct 30, 2018 at 4:36

1 Answer 1

1

Try D1 instead of D3. D3 is io 0, a boot configuration pin with pull-up on board.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.