-->
Page 1 of 1

GPIO INPUT DOESNT WORK!

PostPosted: Wed Jan 25, 2017 3:08 pm
by sbstek
I have a esp-12e module. I have it loaded with the nodemcu firmware. So when i was trying to use a gpio pin to take input. It doesn't work at all.

Here is the code. I flashed it successfully.
Code: Select allvoid setup(){
 pinMode(12,INPUT);
digitalWrite(12,HIGH);
}
void loop(){
int t= digitalRead(12);
if(t==HIGH){
digitalWrite (14,HIGH);
}
}


SO whenever I ground the pin 12 nothing happens the esp wont take any input.
I tried blinking led with pin 14 as well as 12 it works.
I also tried to connect to the WiFi network and connect to twitter and post something using Twitter library and it works.
But digital input isn't working. I also noted one thing that my esp isn't giving proper serial output at any baudrate.

So does this mean my esp is partially damaged?
Do i need to flash another firmware?
Any help is appreciated.

Re: GPIO INPUT DOESNT WORK!

PostPosted: Wed Jan 25, 2017 5:26 pm
by schufti
did you use a pullup on gpio12?

Re: GPIO INPUT DOESNT WORK!

PostPosted: Thu Jan 26, 2017 1:26 am
by sbstek
schufti wrote:did you use a pullup on gpio12?


No i didnt. But i tried using this :
Code: Select allpinMode (12,INPUT_PULLUP);

IT didn't work. I also tried to use pins 4,5 as input it didn't work.
Does it mean i have to pull up thr pins if i have to use them in input mode?