Hi Blynkers,
I need help with blynk library.
Below is a pseudo code where a FOR structure executes a sample replay that lasts approximately 50 seconds.
I believe Blynk.virtualWite (V0, “example”) will not be properly executed.
During this time (approximately after + - 30 seconds) I receive notification in the app that the hardware has been disconnected.
How can I extend the time the hardware stays connected to the server (+ - 60sec) without changing anything in the void function FunctionExample () ??
Is it something on the side of the Blynk Server or on the side of the Blynk library?
I used this example to simplify because the actual use will be with a command library for stepper motor. That does something similar to the example function.
Thanks for all the help.
Calling a function from the void loop() is the same as trying to run everything in that function thousands of times a second… like your Blynk.virtualWrite() if it ever got around to running it.
Also bad is having long blocking loops like your for() that prevent Blynk functions from running… thus disconnecting.
Thanks for the answer.
As I said the code above is just an example. What actually happens is that I have a FOR () loop that takes about 50sec. to execute. When it starts I really can not perform any other activity together. Unless I know the execution time of a certain call to keep the blynk connected.
One call I use to avoid wdt.rst is the ESP.wdtFeed function which returns a feedback to whatchdog from esp8266. I need an idea to solve this. They are great loops for controlling a stepper motor. And sometimes it takes up to 50sec.
tks all
The simple answer is that it’s not possible. Your code will cause Blynk to disconnect.
If you’re prepared to modify the FunctionExample () by inserting a few Blynk.run commands in it then you may be able to prevent Blynk disconnections, but you’d need to experiment with this, and assess the impact of these on your function.
Hmmm, well I’m using delay in code because of the acceleration of the stepper motor I think any routine would take more time than the 20us interval. I think I will have to deal with disconnection or use dedicated hardware to control the motors. Which I think is impractical.
But Blynk.timer works with time base in millis () and as I’m using micro step 1/32 the time drops to something close to 50 microseconds. I do not think it’s possible to use a timer with such a short interval.
But I appreciate all the help.
Hi Gunner
Thanks for the topic.
I have already done another dual mcu application using these libraries in the I2C option.
But like I said, I think it’s too much to use an old arduino. My initial idea in this topic was to use ESP only. But with blynk it was kind of unfeasible.
I even got interesting results using yield () in the FOR () loop. However, the impact of this on the acceleration of the stepper motor is perceptible. RPM’s reduce considerably.
I’ll use ESP01 + Attiny13. This will work good! Thank you all.