-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connecting to 2 or multiple BT serial devices #5447
Comments
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. |
I have seen some activity in the source
maybe someone else has tried to connect 2 devices,
I'd like code example
…On 10/2/21, stale[bot] ***@***.***> wrote:
[STALE_SET] This issue has been automatically marked as stale because it has
not had recent activity. It will be closed in 14 days if no further activity
occurs. Thank you for your contributions.
--
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#5447 (comment)
|
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future. |
Hi. Anyone have any thoughts on this issue? Connecting to one device works great, but I'd also like to make multiple Bluetooth classic connections to devices so I can aggregate some sensor readings. If I simply copy the example code for a single connection and create multiple bluetooth connections, I get an indication that connecting to each of them has succeeded, but when data is received, it is only coming from the last bluetooth device I connected to. I'm running my app within the Arduino IDE using the .available() function.
Here I only see .available() returning true for btUART2 -- the last bluetooth UART I connected to. If I reverse the order of the .connect call, I only see data from btUART1. Any help would be appreciated. Thanks! |
I haven't tested connecting multiple BLE devices simultaneously but I was able to pull data from different sensors by cycling between disconnecting and connecting to the address of the device I want to connect to. Maybe consider that if it works. |
Thanks for the suggestion @khaled147! I can get that to work as well but I'd like it if the sensors could just send me data asynchronously without my having to poll them. Having the |
Thanks, @VojtechBartoska . I'll give it a try once my current release is out. I read through the release notes for 2.0.3-RC1 and didn't see anything directly related to the Bluetooth Serial library except for this issue: #6109 This only seems to be getting rid of a compiler warning... Am I missing something? -- Thanks again for the suggestion! |
There have been some changes in ESP-IDF itself which can have an influence on this and also from the issue description I wasn't sure on which version you are running your code so it's reasonable to test it on v2.0.3-RC1 to have actual results. |
Thanks, @VojtechBartoska. I'll give it a try as soon as I get my release out the door. I’ll also dig into the source for the BluetoothSerial library and see how it’s structured. I suspect there might be a single, global pointer that’s being used to reference the port. This would explain the behavior I'm seeing where the last port to be declared is the one that gets the callbacks. -- Thinking about it, it might just be an architectural issue, where sharing of the Bluetooth hardware resource isn't supported. After all, I don't think you can create multiple, independent instances of Serial with their own callbacks. |
2.0.3 stable is out, any chance you gave it a shot? |
@digamesystems Any news? |
Closing this issue as expired due to no answer, if needed you can reopen it. |
I'd like to connect and communicate at the same
time with 2 different bluetooth devices
each device is providing a single serial port.
Is there some code example how to do it
with BluetoothSerial?
The text was updated successfully, but these errors were encountered: