[SOLVED] pinMode(D8, INPUT_PULLUP) not pulling up
Posted: Sat Sep 03, 2016 9:34 am
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)
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");
}