-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Description
I'm trying to use GPIO16 as a input, where I have pulled GPIO16 high through a resistor, and its pulled low though a push button.
(I'm using an ESP-12E)
If the button is held in for about 1 second, the ESP seems to go into some sort of reset
and outputs this on serial
Exception (0):
epc1=0x40106405 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000
ctx: cont
sp: 3fff2f60 end: 3fff3130 offset: 01a0
>>>stack>>>
3fff3100: 3fffdc20 00000000 3fff3184 402084ae
3fff3110: 3fffdc20 00000000 3fff20f4 4020b162
3fff3120: 00000000 00000000 3fff2110 40100114
<<<stack<<<
Then seems to reboot
I'm just using this really cut down example program that does nothing but set the Serial and pinMode and the start counting up and displaying the count (via Serial)
#define BUTTON_PIN 16
void setup(void)
{
Serial.begin(9600);
pinMode(BUTTON_PIN,INPUT); // Set button as input
int count=0;
while(1)
{
delay(500);
Serial.println(count++);
}
}
I've not seen anything in the docs that suggest I can't use GPIO16 as a normal input.
I've checked my circuit and GPIO16 is not connected to anything else
So I don't really understand why this is happening
BTW. If I briefly press the button i.e less about 1 second, the button can be read using digitalRead
It just seems to be invoking some other function if its held in
Is there some feature e.g. sleep mode that I need to disable to use GPIO 16 ?
PS. I'm not using the very latest version as it doesnt seem to be compatible with my IDE version (1.6.5r5), but its only about 2 or 3 months old.