Disconnection Caused by For Cycle

I have some news

I have tried to comment only the function called inside every single if-condition and the result was that I had no more timeout. So the problem is caused by a non-called function infact no one of if-condition is satisfied so any function nesteld is executed during the sketch and I have the proof of this by putting a Serial.println() inside every single if and I never had a printing result.

So the problem is caused by a non-executed function that seems to be executed.

I will try now to monitor every single function with millis and I will let you know this results.

1 Like

glad you advanced towards isolating the bug!

unfortunately, compared to other coding, the embedded debugging is very limited and sometimes can be hard to find the cause… with time one will gain experience.

serial printlning everything with millis timestamps + variable values is one of the best “tools” to find the bug. you just have to place them in strategical points in the code and further reduce the search area every time.

fortunately, in next arduino ide will be implemented the “add timestamp” checkbox in the serial monitor window, which will automatically put a timestap near every line.

2 Likes

BTW, why use nested if loops… try the more appropreate switchCase

1 Like

I was going to suggest it but thought “hmm would it make such a difference”. Perhaps in the case where the correct switch was one of the top ones I guess, it should still check the conditions of every case until the very last if it is that last that is saved in the variable :stuck_out_tongue:

Hey guys thank you so much for your suggestions.

I have monitored every single function and I have seen at the end that the problem is related to the FastLED library that I am using. Infact some function of this library are too slow for Blynk infact the faster function that I have is 450ms all the others are higher than 1000ms.It depends surely from the library and also of my number of leds. So I have decided to dont use anymore this strip led with Blynk.

You can mark this post as closed.

Thank you all.

2 Likes

maybe this could be helpful:

you should ask @Jamin for details, i think he has the biggest experience in this forum with those led strips…

Why? its the shizzle my doggy dizzle…

Thanks @wanek for linking the thread, @Giorjevic, the FastLED is the best you can get for LED strips. Take a look at my project. Its a little out dated now but still works and easy to build upon.

I am going to release a new version in a few weeks which uses some new Blynk widgets and multi device features but the current version should work fine.

Any “flooding” or disconnects you get are related to the ESP firmware you have installed.

@Costas recommended I update to a new version/revision. I cant find the thread now but I’m sure he can tell you which version fixed the hardware disconnection when sending loads of commands to the ESP.

Good luck and don’t give up yet as the issue is almost never caused by Blynk! :slight_smile:

Direct link to the github with latest code:

Thank you so so so so much @Jamin

I will look your guide with attention while I wait @Costas for the correct version of the Blynk firmware that fixes loads of commands to the ESP.

I hope this can help also if I’m using an Arduino Mega 2560.

1 Like

Yup, just change the connection type and commands in setup() and necessary libraries :slight_smile:

Not Blynk firmware, Arduino ESP8266 core. Most users are still using the bug ridden 15 month old 2.3.0 core, you need 2.4.0-rc2. See the Announcement at WPA2 Compromised: Upgrade all hardware

1 Like

Thank you for suggestion I have just updated the Arduino esp8266 core with the last 2.4.0-rc2.

I was using the version 2.3.0.

1 Like

As soon as I upgraded from 2.3.0 to 2.4.0-rc2… all my disconnection problems went away.

but @Giorjevic, no offense, but when i asked you several days ago about your hw (with the intention to recommend to upgrade the esp core, if it is used), you stated:

and now you say:

than what the f**** is going on? am i missing something?

the same reply for @Fettkeewl:

I was completely blind and I didn’t understand you when you asked me the HW used. I thought that you mean only the board and the shield.

By the way I also have an ESP8266 and I have always considered Arduino and the ESP as 2 different thing.

I am sorry for my ignorance but I didnt know that an ESP library is so important for the correct work of Arduino and Blynk.

yes, thats true. i mean only the board and shield, the hw what you using while experiencing the issues.

i think there is some misunderstandig here:
if you do NOT use esp8266 board with THIS project, afaik, upgrading the esp core will NOT affect nor help resolving the error.

this is correct!

of course, it is good that you upgraded, for your future esp8266 projects, but the mega and ethernet shield has nothing to do with that. they use completely other source.

someone correct me if i’m wrong, @Costas ?

@wanek that’s right the “Arduino ESP core” is for the ESP and has no effect when using an Arduino, even with an ESP shield.

2.4.0-rc2 will only show an improvement over 2.3.0 when the ESP is used in standalone mode.

1 Like

ok, so @Giorjevic, it is clear now?
it is very important to make this clear!

Yes now I have it more clear.

So the timeout problems still persist if a retry running the same code , right?

unfortunately, yes. did you have any serious reason to use arduino + ethernet for this project?

for esp at least you have ready made and tested code by jamin. just use it…