# ESP8266 - PULLUP resistor using Arduino code

I'm having some trouble with this ESP8266, to switch UP, DOWN, OFF dual relay, using Arduino code and a physical 3 states switch.

The code defines input GPIOs 12,14 as INPUT_PULLUP to avoid cases that from time to time ( say once a day ), I get a phenomena that is typically for not using a pull-up resistor.

What can cause such a thing? Can it be that GPIO12, GPIO14 does not HAVE a pull-up resistor on-board?

Relevant code (that defines inputs and outputs):

void setup() {

Serial.begin(9600);

pinMode(switchUpPin, INPUT_PULLUP);
pinMode(switchDownPin, INPUT_PULLUP);
pinMode(relayUpPin, OUTPUT);
pinMode(relayDownPin, OUTPUT);

digitalWrite(relayUpPin,HIGH);
digitalWrite(relayDownPin,HIGH);


No, GPIO12 and GPIO14 have internal pull-up resistors (see table below). If they are properly setup in software I would suggest looking at the output (relay control circuit). Since you provided no information about the relay or how you control it I can't give a better answer.

Table from here

• thank you. Dual relay link added to Q, and piece of the code. – Guy . D Nov 2 '18 at 10:01

The NodeMcu has no pull-up on pins 12 and 14. The esp8266 has internal pull-up and you activate it with pin mode INPUT_PULLUP. Without activated internall pull-up, there is no pull-up for this pns.

• As you can see in my code, it IS initiated with INPUT_PULLUP but the behaviour, scarcely, seems it does not have any. – Guy . D Nov 3 '18 at 18:07
• you say that the internall pullup doesn't help? – Juraj Nov 3 '18 at 18:12
• I say that, I had some occurrences that erratic triggering happened ... – Guy . D Nov 3 '18 at 18:14
• ...while already using internal pull-up. I was not sure how to understand the question. So voltage drops while WiFi consumes too much power? – Juraj Nov 3 '18 at 18:17
• you know I have my language limitations :) - Yes, it happened when PULLUP was already defined in code. I'm using a 2A DC adaptor, I doubt if the esp8266 consumes power in that scale. – Guy . D Nov 3 '18 at 18:41