I have a project which has run fine in legacy Blynk. When trying to covert to Blynk 2, my code causes a hiccup when entering certain pinmodes in the setup section.
I am using a Wemos D1 mini.
The two lines commencing with ‘//’ are the lines causing the issue. When I run the code with either of these lines included, Blynk fails to connect through the internet. Without these two lines, Blynk connects up fine ( but does require that I re-configure the wifi name and password again!).
@nikki-m please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```
For some reason, the legacy code also ran happily with the "D " designations. It appears perhaps that Blynk 2.0 is not happy with them.
The two lines that failed on Blynk 2 are currently marked with ‘//’.
I think I have used the wrong chart for my conversions. Eg D3 in my chart says 18, but I understand should be 0.
I have 4 outputs and 3 inputs on this project? As this project runs in legacy, surely there are enough IO ports in Blynk 2.0?? Many many user-friendly ports are there actually available on this chip?
It’s not the Blynk library that decides that’ it’s the board type you select in the Arduino IDE.
I guess you selected “Generic ESP8266” instead of “LOLIN(WEMOS) D1 RS & Mini”
Blynk doesn’t have any I/O ports, its the board that has the ports.
The D1 Mini has sufficient suitable GPIO pins for this, but your original choice of pins probably wasn’t as well informed as it could have been, you should read this…
Also, your decision to have 54 timers all being called simultaneously every 1000ms isn’t a great idea…
You should read the “Staggering Timers” section of this post for more info…
Sorry, I meant to say IO ports in the D1 mini, but my fingers decided to type something else.
I was just reading the very article about the IO ports of the device when you replied. So I will replan these port allocations.
As regards the timers - the legacy project was from when I was just learning about programming. I was planning to change that part of the code after It got it running on Blynk 2.
So it looks like I need a bit of a re-write on this project. Luckily, most of my others seem to be converting nicely. Well, as nicely as Blynk 2 will allow. Why, when the rest of the world is adding ‘dark mode’, does Blynk decide to take it away? I [used to] run all my projects in dark mode.
You should also be aware that GPIO2 is the pin that the onboard LED of the D1 Mini is attached to.
It is used in the settings.ini tab of the ESP8266 Edgent example to give feedback during the provisioning process, so you should avoid using it for anything else.
I think aesthetics gets a lower priority than functionality at the moment.
I have loaded the code into a NodeMCU ESP12 module. This connects up and runs fine, producing the following info:
[4829] Using Dynamic IP: 192.168.43.105
[4829] CONNECTING_NET => CONNECTING_CLOUD
[5041] Current time: Thu Jul 8 13:32:25 2021
[5041] Connecting to blynk.cloud:443
[6234] Ready (ping: 12ms).
Alarm Start-up: 1
[8529] CONNECTING_CLOUD => RUNNING
However, when I load the code into a second NodeMCu device or a Wemos D1 mini, these devices does not connect to Blynk. I get the following info:
[820] Connecting to WiFi: Puddlenet 2
[4677] Using Dynamic IP: 192.168.43.39
[4677] CONNECTING_NET => CONNECTING_CLOUD
[4889] Current time: Thu Jul 8 13:34:17 2021
[4889] Connecting to blynk.cloud:443
[6167] Redirecting to lon1.blynk.cloud:443
[6175] Current time: Thu Jul 8 13:34:18 2021
[6175] Connecting to lon1.blynk.cloud:443
[7347] Redirecting to lon1.blynk.cloud:443
Any advice you can offer on why this is so? What is upsetting some devices but not others when running the same code?
Where can I find any pages which provide specific information about points to be aware of when programming code for Blynk2 as opposed to legacy Blynk? This sort of information appears to be sparce. I have several D1 mini boards running legacy code, but need to be aware of parts of the code which might not work with Blynk 2.
Yes, Pete, I am using the same template ID. I am loading the same .ino file into each device. Now, I cannot get any newly-loaded devices to connect. The only ones I now have working are ones I loaded yesterday. And yes, from the same .ino file with the same template ID.
I have even tried putting a static Authtoken into the code, but that failed, too. This is all so frustrating.
And the documentation is so poor for folk who do not yet know the new system. Just as an example, if I refer to any help documentation for widgets on the blynk2 mobile app, it still refers to ‘energy’ from the legacy version. This is Blynk2’s own documentation!
No, I am currently in the Netherlands. But my internet service comes through my (UK-based) EE mobile contract (connecting to whichever local service is offered to me as I travel through the country).
I am currently using Blynk v1.0.0. I have previously also used the beta 3 version, with the same results.
I am currently using dynamic provisioning, but have tried (also unsuccessfully) using static provisioning.
The version of code I have successfully loaded onto a NodeMCU is able to be successfully reconfigured for wifi. I have tried this several times and it has reconfigured each time. Surely this suggests that the network internet connection is ok.
This sounds very similar to an issue I have trying to migrate a previously functioning sketch to “Blynk2.0”.
If I add the device template and device name defines and a static auth token.
The device will connect to wifi, and then fail to connect to Blynk in the exact same manner as yours.
I assumed my issue had to do with the fact that I’m using an ESP32-CAM and I have been unable to successfully compile a program when using the Espressif driver combined with BlynkEdgent and was also unable to have a legacy program connect to the new Blynk servers when statically provisioned.
Seems like the issue might be different than I thought.