Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By cems
#54371 I have tried the following on a HUZZAH and 2 different nodeMCU 1.0 boards (12E) that I am programming via the Arduino IDE 1.6.10 (I can also use platformIO as an IDE).

I am trying to use the internal pullup on various pins (D8 or D4 which correspond to GPIO15 GPIO2 respectively) without any success. I am modifying the standard Blink program to add the following line to setup()

pinMode(D8,INPUT_PULLUP);

alternatively I also tried instead to use this style of pullup:
pinMode(D8,INPUT);
digitalWrite(D8,true);


Then in the loop() I add:
Serial.println(digitalRead(D8));

I'm expecting to see the input will read as a 1, but what I get is a set of zeros. If I connect something external to the input then I can make the input either a 1 or a 0 so it's working as an input. But the pullup is not working.

Googling I see discussions of, at one time, INPUT_PULLUP not working and then some fellow named zeroday fixing it so it did work. But all these discussions seemed to be about nodeLua so I don't know if they apply to programming in Ardunio IDE.

The Arduino website also says INPUT_PULLUP should work on the ESP8266

Anyhow I'm posting this in sept 2016. Surely this should be working??? all boards behave the same and all the pins i've tried act similarly. (I realize that GPIO 16 is special and I'm not trying that pin)

Code: Select all#include <Arduino.h>
#define ESP8266_LED 2

void setup()
{

  pinMode(ESP8266_LED, OUTPUT);
  Serial.begin(9600);
  Serial.println("setup");
  pinMode(D8,INPUT_PULLUP);

}

void loop()
{
 
  Serial.println(D8);
  Serial.println(digitalRead(D8));
  digitalWrite(ESP8266_LED, HIGH);
  delay(500);
  digitalWrite(ESP8266_LED, LOW);
  delay(2500);
  Serial.println("loop de doop bb");
}
Last edited by cems on Sat Sep 03, 2016 4:41 pm, edited 1 time in total.
User avatar
By cems
#54402 Thanks.

SO THE SOLUTION TO MY PROBLEM IS THAT I RANDOMLY DECIDED TO USE PIN D8 for the test and of all the pins this one is pulled down externally. GAAH! And then I totally confused myself by then choosing D4 (GPIO2) as the next randomly chosen pin and it's the only other pin this fails on due to the the external wiring to the LED.

:lol: FACE PALM.

I've alos noticed that some other pins cause problems as well (like GPIO 1 which kills the serial monitor when pulled high). and some pins are pulled high externally.

Is there a good way I should be able to know these externalities in advance?