NodeMCU

Hello,

I try to read if a radar switch sensor is high or low.
This is the code:
int mwsensor = 7;

void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(mwsensor, INPUT);
}

void loop() {
// put your main code here, to run repeatedly:
digitalRead(mwsensor);
Serial.println("hoi");
delay(1000);
}

I upload the code to the NodeMCU and this is returned in the serial monitor:
ets Jan 8 2013,rst cause:4, boot mode:(3,6)

wdt reset
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v8b899c12
~ld

I have no idea what's wrong. Normally I can upload code without any problem.
Can you please give me an advise.
Thank you.
Yvonne

Hi Yvonne. I can see from your previous posts that you know how to use code tags. Did you forget?

a radar switch sensor

I assume you found out how to use code tags by reading the forum guide in the "please read" sticky post. There was other advice there, do you remember? Like posting links to the components and modules you are using.

Looking at your code, which fortunately was readable even though you did not use code tags, the problem may not be your code. Please post a schematic, including details of the power supply you are using. The watchdog error you posted makes me wonder if your circuit is not powered adequately.

Aren't GPIO6-11 to be "avoided" as they are associated with the flash mem?

Using "D7" is a different matter -- it isn't GPIO7 (it is GPIO13).

const byte mwsensor = D7;

Dear all,

You are right, I should have used code tags. Sorry for the inconvenience.
I mentioned by rewiring to get the code workind without errors.
Thank you very much for your suggestions.
I will use code tags next time.

Yvonne