How to implement Blynk in existing Arduino project?

Hi,
I’m new here, tried to find relevancies but no real answers came up.
As I’m getting a bit familiar with Blynk, I start get an impression that most of the examples use this different approach that the loop() contains barely anything and the library handles everything.
Well, what I would need to do is wrap the Blynk around my project where the main thing happens in the loop() and functions. Not the other way around, so I don’t want Blynk to do anything but make a channel of communication, nor I want to wrap my project around Blynk.

I tried to understand how does it work, so the idea was to take the bare bones only of the library, but I find only header files and no source code. Where is the source code? I would like to see what does the Blynk.run() do for example (or the SerialBLE), but couldn’t trace it back to it’s source.

All I’m curious of is the exact code for the virtual pins, how to address those, how to translate my own UART protokoll to these.

The other thing is BLE and ESP32. I saw that topic which says there’s no support yet, because there’s no Arduino implement yet (and here I’m already using BLE in Arduino and can connect to my Android in BLE UART apps). In the other hand in the mobile app I could select ESP32 with BLE as a device, but couldn’t connect with the BLE widget. Do I need the Blynk in the firmware first? I wouldn’t think I need anything on the device just to be able to connect to it.

What I’m trying to accomplish is to control my ESP32 over BT. I don’t use wifi or internet for this, so I don’t need the cloud part of the service, no servers at all.

Any input would be appreciated, thanks!

You will not find the answers you are looking for if only reading a few posts for a few minutes :wink: But you kind of did answer you own question…

This is basicly the idea… think along the lines of taking a large ‘static’ object and turn it into a mobile process along a skinny path. The best way to do such is break it into manageable chunks, each on its own "trailer’, then send it on its mobile, but still overall functional,way…

The Blynk library is not handling “everything”… mainly the interface communication and virtual pin functions and Blynk.run() is like the handler for all those processes.

BlynkTimer is responsible for the running of the rest of your code in timed functions instead of one big loop. It is based on the SimpleTimer library, so Blynk is not exclusive in this methodology.

This is basically the root answer to your title question; Take an existing Arduino sketch and “Blynkify it” I.e. break your code down into individual functions that can be ran on timers and simply add these timed but still interactive functions back into a Blynk sketch that sets up the required communications and timer libraries.

It is open source, so you are welcome to try… but you are probably on your own for that as that is not the purpose of this forum… we are here to assist you in learning and utilising Blynk as it is.

Blynk is predominantly a IoT interface… thus the focus has been on WiFi.

Basic BT and BLE functionality is there (as a means of linking the MCU and the App for Blynk’s internal purposes, not as an open communication channel) and may get improved, but that is reportedly down the road.

Meanwhile I think ESP32 BT/BLE is still a work in progress in of itself?? (I haven’t tried BT/BLE yet on my ESP32) That’s up to espressif, not Blynk.

Well, honestly then… Blynk may not be quite what you are looking for, as (for now) you need the App (which is NOT open source) and it’s WiFi/network server link to create an account and to manage the projects… even when using BT/BLE.