seeking help for connectivity issues in esp32 bluetooth with android
I found this code for connecting the bluetooth
#include "BluetoothSerial.h"
BluetoothSerial SerialBT;
bool isConnected = false;
void setup() {
Serial.begin(115200);
SerialBT.begin("ESP32_BT"); // Bluetooth device name
Serial.println("The device started, now you can pair it with Bluetooth!");
}
void loop() {
if (SerialBT.hasClient()) {
isConnected = true;
Serial.println("Connected");
} else {
isConnected = false;
Serial.println("Disconnected");
SerialBT.disconnect(); // Ensure any previous connections are closed
delay(5000); // Wait for 5 seconds before attempting to reconnect
SerialBT.begin("ESP32_BT"); // Restart Bluetooth
}
if (isConnected) {
// Handle your code when connected
}
delay(1000); // Check connection every second } but i can connect with this when the "serial bluetooth app "(available in playstore) for only serial communication but i want to make a home automation system with bluetooth so i want that when i am in range of esp then bluetooth will automatically connect with android and i can on off any device with my app
delay(1000); // Check connection every second } but i can connect with this when the "serial bluetooth app "(available in playstore) for only serial communication but i want to make a home automation system with bluetooth so i want that when i am in range of esp then bluetooth will automatically connect with android and i can on off any device with my app
13 Replies
new post created: https://discord.com/channels/1130679493799977062/1273400723882905711/1273400723882905711
This channel has been locked and archived
@melta101 I am going through these old posts and summoned this from the dead. However, I realize you may have some shared experience here.
@lucifer2615. it would be great to hear if you were able to resolve this, and either way it's a good reference for the future, @melta101.
if you're serial comm is working, then the working is mainly on the andriod-app side,
where you would need to read the the bluetooth data from the bluetooth adapter socket(don't know the exact terminology from andriod, but the context would be the same as linux)
related to autoconnection,
is your ESP discoverable?
oh wow, just realized that the post is ancient
maybe before i joined
It's only ancient if @lucifer2615. doesn't respond. And even then, it lives on in spirit.
there was no 'before you joined'. you are the alpha and the omega.
Let's see if lucifer jumps back in and if not i'll close, lock, and archive this post in a couple days.
yea.
So sorry about that mate!!, Kinda busy in some work but I'll make sure that you get your reply by today...
it's cool
Hey Luci,
Any chance you could swing back with an update?
@techielew yeah sure, currently figuring out the custom web page for product and after that i will go to some api data extraction stage
if we can do a discord call or any other option that would be better
@lucifer2615. this and the question in your other post may be worth some advisement from @Surfskidude
i didn't understand sorry
@techielew
Check out this Xedge32 page on GitHub: https://github.com/RealTimeLogic/Xedge32
GitHub
GitHub - RealTimeLogic/Xedge32: Xedge ESP32 peripheral API and Buil...
Xedge ESP32 peripheral API and Build Files. Contribute to RealTimeLogic/Xedge32 development by creating an account on GitHub.
oops i should be in the other post thread