nodemcu and wifi

Good evening all. My name is jim, im starting to try and learn coding on the arduino , but old age and lack of memory does not make it easy.
Please can someone help me?
I have made a circuit to monitor battery voltage on my car. I have used example code and even squeezed in some bits i have worked out for myself, and managed to get it to send battery voltage to thingspeak, but its early days in the learning curve and now im stuck.
Board works great when its near enough to my wifi, but when parked to far away, it continually tries to connect to my wifi, and it wont finish the program and go to sleep for x amount of time like it does after a normal connect/transmit. I know its just one or two lines of code, and your all laughing about now, but ive not been able to grasp the basics yet.
I just want to add code that allows it to try to connect a few times, or for a few seconds, and when it fails, go to sleep for x amount of time before it tries again. The whole point is to monitor for intermittent heavy power drain, and having it making endless connection attempts doesn't help. Any help would be greatly appreciated.
jim

posted under "Introductory Tutorials" should be in programming questions!

ok sorry

Imagine that we can't see your code, or your schematic.

It shouldn't be too hard, because we can't.

Now, show us what we need to know, to help you.

Sorry wrong place to post,,,, now in programming questions