connected = SerialBT.connect(address) return value
connected = SerialBT.connect(address) return value
I'm calling SerialBT.connect(address) to connect to an HC-05 module by address (Bluetooth classic). It's working fine, but it always returns TRUE regardless of whether it successfully connected or not. I can also call connected() and get the same results. I can't find any way to determine whether I actually have a bluetooth connection. Any tips would be greatly appreciated.
Re: connected = SerialBT.connect(address) return value
i asked almost exactly the same question a few days ago. Still no suggestions
romeo
romeo
Re: connected = SerialBT.connect(address) return value
So I tried a function call
if(SerialBT.hasClient())...
and that seems to do exactly what I am looking for. LED comes on when I connect the android, and goes off when I disconnect.
Hope this helps.
Sadly, i don't seem to be able to find any documentation that describes what these functions do.
romeo
if(SerialBT.hasClient())...
and that seems to do exactly what I am looking for. LED comes on when I connect the android, and goes off when I disconnect.
Hope this helps.
Sadly, i don't seem to be able to find any documentation that describes what these functions do.
romeo
Re: connected = SerialBT.connect(address) return value
Thanks! It looks like that should do what I'm looking for. Using that as a Google search term I found this...
http://chiselapp.com/user/jschimpf/repo ... P32Lib.pdf
I haven't looked at it closely, but this might give us some more insight to the library.
Thanks again!
http://chiselapp.com/user/jschimpf/repo ... P32Lib.pdf
I haven't looked at it closely, but this might give us some more insight to the library.
Thanks again!
Re: connected = SerialBT.connect(address) return value
Hello guys, pls, did this really worked for you ? I tested that connected = SerialBT.connect(address); returns the true value only when it is first connected in my case at least.
When the Master lost the connection I was able to catch this with if (event == ESP_SPP_CLOSE_EVT) and reconnect the the connection.
The reconnected worked OK but the connected = SerialBT.connect(address); returned false for the next attempts.
The same result was with the if(SerialBT.hasClient()). The first attempt worked OK and the connection was recognized but next attempts didn't work. They returned false even if the connection was established and I was able to send/receive messages via serial monitor.
When the Master lost the connection I was able to catch this with if (event == ESP_SPP_CLOSE_EVT) and reconnect the the connection.
The reconnected worked OK but the connected = SerialBT.connect(address); returned false for the next attempts.
The same result was with the if(SerialBT.hasClient()). The first attempt worked OK and the connection was recognized but next attempts didn't work. They returned false even if the connection was established and I was able to send/receive messages via serial monitor.
Who is online
Users browsing this forum: Google [Bot] and 50 guests