WDT reset problem - ESP8266MOD

Hi,

I am new to the Arduino. I am facing a strange WDT reset problem while enabling a pin as an input.
I have connected a switch into pins GPIO12 and GPIO13. If I added the following line in my program its getting reset.

pinMode(6, INPUT);

wdt reset
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
vbb28d4a3

Selected board as -> Node MCU 1.0 (esp12E)

Kindly help me to solve this issue.

Thanks.

I have connected a switch into pins GPIO12 and GPIO13.

How? What makes you think that there is a relationship between either of these two names and the numeric value 6?

And what do you plan to do with that pin, read a button ? do you use a loop ? ESP wdt reboots the board if it hasn't been reset after 2.5ms, either a delay() or a yield() resets the wdt or the end of void loop() (which incurs an automatic yield() and then restarts loop() )

Thanks For the reply. Here I attached my test code.
I had connected two switches in GPIO12 (Pin no 6) and GPIO13 (pin no 7). Its normally pull up.
If I configured the pins as input then I am getting WDT to reset in the serial monitor. If I removed these lines I won't get reset message but the switch input was not working.

pinMode(buttonPin, INPUT);
pinMode(buttonPin1, INPUT);

How to relate the GPIO number and pin number in code?
Define the GPIO or pin number?

//--------------------------------------------------------------------------------
const int buttonPin = 6; // the number of the pushbutton pin GPIO12
const int buttonPin1 = 7; // the number of the pushbutton pin GPIO13

int TestPin = 20;

int Relayout1 = 19;//GPIO4
int Relayout2 = 20;//GPIO5
int Relayout3 = 11;//GPIO9

int reading =0 , BounceReading = 0;

/*Function declarations --- */
void ScanKeys (void);

void setup() {
// put your setup code here, to run once:

Serial.begin(9600);
Serial.println("Code Started.. \n");

//Init Button pin mode

pinMode(buttonPin, INPUT);
pinMode(buttonPin1, INPUT);

}

void loop() {
// put your main code here, to run repeatedly:

ScanKeys();
delay(1000);
}

void ScanKeys (void)
{
reading = digitalRead(buttonPin); //gpio12

if (reading == HIGH)
{
Serial.println("High \n");

}
else
Serial.println("Low \n");

}

How to relate the GPIO number and pin number in code?
Define the GPIO or pin number?

Define the GPIO nr, don’t bother about the pinnr. The GPIO nr is what the compiler translates to pinnrs for you.

I have modified the definition like below, but still, my board getting reset :frowning:

const int buttonPin = 12; // the number of the pushbutton pin GPIO12
const int buttonPin1 = 13; // the number of the pushbutton pin GPIO13