In my sktech I use timer (setInterval) that I handle easily and everything goes well. I also use the setTimeout function and since 2 weeks now, I am face with the following problem: when I compile with VS17 I have multiple connection errors which is not the case when compiling with IDE Arduino … I don’t understand why. I probably do something wrong, I tryed many solution and finally stay on the same place. I no longer move forward in my project, I get discouraged and feel like wasting my time. So I come here to find any help to solve that.
I would like to share my sketch but Don’t know how to do - Would really appreciate you to help me to solve it.
You might be right, I have to precise the situation.
In the upper part of the code, are 3 functions to make relays working in a certain way: relayMain, relayOff and relayOn. The functions are connected together with setTImeout method.
Before writing them, everything was okay, but since trying to make them working together I always disconnect from Blynk server. I gess it is related with setTimeout method, but don’t know how to solve that. Do I use setTimeout correctly or not, should I declare it anywhere else ? could you provide any advises ?
Below are some lines of my serial track:
BLYNK CONNECTED
[163081] Time sync: OK
Uptime value 163
[276101] Connecting to blynk-cloud.com:80
[279148] Login timeout
[281148] Connecting to blynk-cloud.com:80
[284193] Login timeout
[286193] Connecting to blynk-cloud.com:80
[289236] Login timeout
[291236] Connecting to blynk-cloud.com:80
[294280] Login timeout
[296280] Connecting to blynk-cloud.com:80
[299328] Login timeout
[301328] Connecting to blynk-cloud.com:80
[304384] Login timeout
[306384] Connecting to blynk-cloud.com:80
[309428] Login timeout
[311428] Connecting to blynk-cloud.com:80
[314476] Login timeout
[316476] Connecting to blynk-cloud.com:80
[319524] Login timeout
[321524] Connecting to blynk-cloud.com:80
[324277] Ready (ping: 2710ms).
BLYNK CONNECTED
[324454] Time sync: OK
Uptime value 324
[351797] Connecting to blynk-cloud.com:80
[354606] Ready (ping: 2760ms).
BLYNK CONNECTED
[354785] Time sync: OK
Uptime value 354
[457314] Connecting to blynk-cloud.com:80
[460361] Login timeout
[462361] Connecting to blynk-cloud.com:80
[465409] Login timeout
[467409] Connecting to blynk-cloud.com:80
[470455] Login timeout
[472455] Connecting to blynk-cloud.com:80
[475499] Login timeout
[477499] Connecting to blynk-cloud.com:80
[480454] Ready (ping: 2911ms).
BLYNK CONNECTED
[480630] Time sync: OK
Uptime value 480
[526060] Connecting to blynk-cloud.com:80
[529104] Login timeout
[531104] Connecting to blynk-cloud.com:80
[533935] Ready (ping: 2789ms).
BLYNK CONNECTED
[534111] Time sync: OK
Uptime value 534
[576832] Connecting to blynk-cloud.com:80
[579877] Login timeout
[581877] Connecting to blynk-cloud.com:80
[582225] Ready (ping: 302ms).
This just says you are connecting and disconnecting… doesn’t mean much to us
Well except for this …
Your ping is somewhat high… perhaps your issue is not your code but your connection?
I am not going to dig through all your code to troubleshoot it for you, that’s not really what we do here.
We are users assisting users, but also have our own lives and code to focus on. We mainly try to assist others with learning about Blynk, where to find documentation, etc.
I don’t know, not sure exactly where in your code you are referring too.
But it is a simple timer Each time it is called it waits x amount of time (in the background, while other things continue to happen as code dictates) then runs assigned function. That’s it.
You might be right, connections interruption issues seem to be related with internet… I will investigate deeply in that way. Thanks for put me on that way.