BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Sync App with bluetooth BLE connection

I’m using a Bluetooth BLE module. The connection works. Each time the app is started up, it takes about 6/7 seconds to connect, but it doesn’t synchronize the label’s widgets automatically, but only if I press on a segmented switch input. Is it a bug?

I have

BLYNK_CONNECTED() {
Blynk.syncAll();
}

I try with a timer every 5 seconds to do a Blynk.syncALL() but it never syncs. I have to press an input on the segmented switch. If I exit the app and return in immediately, it only shows me the default values ​​of the widget, but not the real ones on hw.

I use Android, and latest libraries installed.

You can see in the video that when I exit and return in app, all the widgets label don’t sync.
The blue online LED widget is for know when the connection is really estabilished.

https://youtu.be/qY3fZnCnu1g

The value is right, but the label is not. And it doesn’t put the last “writing” back, but the default one (which is obviously wrong). Is there a solution to ensure that when you open the app, it automatically simulates the pressure of an input to synchronize everything?

Thanks!

I seem to remember that Blynk.sync is one of those commands that doesn’t work correctly with Bluetooth.

But, your description of the problem is also a bit confusing. Blynk.sync will normally (when using an internet connection) synchronise the hardware with the values stored in the app (on the Blynk server actually). If you want to push values from the hardware then it’s a virtualWrite command that’s needed.

Pete.

sorry for confusing :stuck_out_tongue:

The “problem” is that the label of widget return on default every time I open the app and don’t remain the last write from HW. I can have the correct label only if I push a widget input (cause I write label in every “case” of segmented switch).

I think the label does the same thing with an internet connection. It only changes when you do a label or background write.

Yes, but it’s useful to have label update too.

An idea would be: when open app, there is a trigger, and in the HW, when trigger read, do a sync/void/update (with properly code).