Some data pins are always in logic 1

Hi, my friends

In my nodeMCU project, I am defining some gpios as input. I will connect them some sensors. Although I am using pulldown resistors (10K), especially D3 and the other some data pins always stay in HIGH.
I want them to stay in LOW until the sensors outputs go to HIGH. My piece of code is as follows…What is the problem? Help me please…Thanks.

void setup()
{
  pinMode(16, INPUT); // define D0 as input
  pinMode(5, INPUT);  // define D1 as input
  pinMode(4, INPUT);  // define D2 as input
  pinMode(0, INPUT); // define D3 as input 

You should format your code correctly.

Be careful with GPIO16 and GPIO0, they have special uses and will cause you issues.

Have you tried doing a digitalWrite(pin_number,LOW) ?

Pete.

As you recommended I have tried

digitalWrite(0,LOW) ? in “void setup()”

but D3 still in HIGH mode…Also I don’t think this code can be used since I want to define D3 as input, not output.

If I connect D3 to ground without any pulldown resistans, does that become dangerous for the nodemcu?

Do you not have any regular pins left?

What do you mean with regular pins?

I have solved the problem after making some search in the internet. Some io pins are connected to High via pull up resistors, so they can not be used as high impedance input, but some others can…

1 Like