I’m using BluetoothLE.RegisterForStrings to get a string from an esp32, BUT I can’t seem to find a way to stop it from polling so i can use BluetoothLE.WriteStrings to send strings to the esp32.
I follow the tutorial and put RegisterForStrings under When BluetoothLE.Connected
I even tried putting in a Clock to time out after a few seconds, but still doesn’t work.
I also tried the BluetoothLE.UnregisterForValues and that didn’t work.
The only way I can get it to stop and allow WriteStrings is to disconnect it and then reconnected it again.
Dear @Harry_Dogg,
in the linked thread, I've posted some code of mine (app + ino+ an explanation) on how to make a double connection, BLE and Classic BT, between an ESP32 (2 boards) and an Android device (a Lenovo pad featuring Android 9).
Please give it a look, probably you can find some help. For example the "register for string" is made only once after the app initialization, by means of a clock, which is disabled after its first event. Since you want to use the BLE only, you don't have to care about the .ino for the ESP that is running the Classic BT, but anyway, I hope the rest can help. Best wishes.
You can receive and transmit strings “at the same time” ( I mean no need to disable one function to use the other ).
P.S.
I find that esp32s3 works “more reliably” with ble than esp32 ( but this may depend on the phone I’m using, quite old ), and surely bluetooth classic even easier to manage with esp32/ai2
Ciao Davide, condivido appieno la tua valutazione sul fatto che il BT classico sia estremamente più semplice da usare, ma hai visto che ci sono persino degli HC05 "fake" che in realtà sono dei BLE. Giusto per complicare le cose semplici.
Ciao !
You can change the frequency of the polling by using a Clock Timer for Strings Received instead of Register For Strings. Or in the ESp32 script you can do a similar thing and receive when not sending.
Thanks, I’ll give it a look. I ‘temporary’ solved it by receiving byte rather than string. Since the strings were just numbers anyway, just split them up into an array and sent them one at a time from the esp32. This is the only way I found to be able to send and receive.
I also read that so it’s baffling to me why I can’t receive and transmit at the same time. Even when it’s not receiving anything it still won’t transmit unless I disable the RegisterForStrings block. I’m using an esp32 s3 supermini, which is why I have to use BLE.
I think I tried that, but it won’t let me received anything if I don’t use a Register. It’s not an esp32 issue, I’ve killed the loop after sending the string but that RegisterForStrings just will not stop polling even when the esp32 isn’t sending anything.
Dear @Harry_Dogg, thanks for your fbk. Honestly I'm not a guru on the supermini esp32 s3, but if you want me having a look on the .ino file, please post it here.
Cheers.