Reset NodeMCU w/Putty

I'm looking for a way to either have PuTTY reset my Arduino when a connection is made or either have the Arduino watch for a new connection and reset itself. Any suggestions?

Do you mean more of a reset than you always get when opening a connection, which at least runs setup() although I'm not sure what's missing compared to a hard reset.

When you open a serial connection to most Arduinos, they are reset. Only exception that I'm aware of are the 32U4 based ones

Why do you need to reset an Arduino?

I'm looking to restart my void loop() when I connect with PuTTY so that my code starts from the beginning.

You mean without running setup()?

What model?-Is it a 32u4 Arduino?

This is a NodeMCU.

What I have is a sketch that controls an air conditioner.

I want to use PuTTY for serial comms but when I connect to the correct port, the sketch is already running and I may not know where the program has stopped so I would like the NodeMCU to reset when I connect with PuTTY so I see the first set of instructions every time.

This sounds more like "I wrote a bad program" rather than "I need to reset the device".

Considering I’m, at best, a novice, I guess I could agree with that since I honestly don’t know if that is the case here.

But this is a Project Guidance forum and since I’ve exhausted all other resources, I’ve finally succumb to asking for help.

Also, when examining this code, I know that the use of “goto” is apparently frowned upon and says

“Hey this guy doesn’t know his a$$ from a hole in the ground!”…

but this is my first successful attempt at getting this task to work after a couple of months of working at it on and off. That said, I’ll work on finding a better way once my brain cools off.

Pioneer_AC.ino (13.2 KB)

This is a NodeMCU.

OK I have no idea what that is, but it’s easy to see if an Arduino is resettting by just sticking a Serial.println(“I’m in setup”); in setup() and that will appear every time it starts.

The thing is, I know it's not resetting when I connect to it with PuTTY.

It's still running its loop.

What I wondering is if there is a way to reset the device when connecting it to PuTTY, regardless to what state its in.

You should perhaps change the title of the opening post to include "NodeMCU".