Skip to main content
Post Closed as "Not suitable for this site" by VE7JRO, Rohit Gupta, jsotola
Syntax highlighting, spelling and capitalization.
Source Link
VE7JRO
  • 2.5k
  • 19
  • 28
  • 31

I am trying to connect ESP32 via bluetooth classic to my PC to transfer some data from a sensor.

As a first step, I am simply trying to send some random data over bluetooth serial. The code is at follows:

#include "BluetoothSerial.h"

#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif

int myData[8];
BluetoothSerial SerialBT;

void setup() {
  Serial.begin(115200);
  Serial.println("Opening Serial Connection on COM4");
  SerialBT.begin("ESP32"); //Bluetooth device name
  SerialBT.println("Opening Serial Bluetooth Connection on COM6");

 
}

void loop() {

  for(int i = 0; i < 8; i++)
  {
    myData[i] = random(0,500);
  }
  if(Serial.available())
    {
 
     for(int i = 0; i < 8; i++)
  {
    SerialBT.write(myData[i]);
  }
   
     
    }
    delay(20);
}
#include "BluetoothSerial.h"

#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif

int myData[8];
BluetoothSerial SerialBT;

void setup() {
  Serial.begin(115200);
  Serial.println("Opening Serial Connection on COM4");
  SerialBT.begin("ESP32"); //Bluetooth device name
  SerialBT.println("Opening Serial Bluetooth Connection on COM6");

}

void loop() {

  for(int i = 0; i < 8; i++)
  {
    myData[i] = random(0,500);
  }
  if(Serial.available())
    {
 
     for(int i = 0; i < 8; i++)
  {
    SerialBT.write(myData[i]);
  }
      
    }
    delay(20);
}

In Windows bluetoothBluetooth settings, I have paired the ESP32 with windows and connected it. I have set up incoming and outgoing COM ports for bluetoothBluetooth where incoming port is COM6COM6 and outgoing port is COM5.

However, when I open arduinothe Arduino serial monitor for COM6, it is empty and no data is being printed. I am using arduinothe Arduino IDE. Furthermore, on COM4, there is nothing printed despite the Serial.println("Opening Serial Connection on COM4");Serial.println("Opening Serial Connection on COM4"); command which I think should work regardless of bluetoothBluetooth.

I have tried everything I can think of. I would be grateful if anyone can help me solve this problem as I have been stuck for days.

I am trying to connect ESP32 via bluetooth classic to my PC to transfer some data from a sensor.

As a first step, I am simply trying to send some random data over bluetooth serial. The code is at follows:

#include "BluetoothSerial.h"

#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif

int myData[8];
BluetoothSerial SerialBT;

void setup() {
  Serial.begin(115200);
  Serial.println("Opening Serial Connection on COM4");
  SerialBT.begin("ESP32"); //Bluetooth device name
  SerialBT.println("Opening Serial Bluetooth Connection on COM6");

 
}

void loop() {

  for(int i = 0; i < 8; i++)
  {
    myData[i] = random(0,500);
  }
  if(Serial.available())
    {
 
     for(int i = 0; i < 8; i++)
  {
    SerialBT.write(myData[i]);
  }
   
     
    }
    delay(20);
}

In Windows bluetooth settings, I have paired the ESP32 with windows and connected it. I have set up incoming and outgoing COM ports for bluetooth where incoming port is COM6 and outgoing port is COM5.

However, when I open arduino serial monitor for COM6, it is empty and no data is being printed. I am using arduino IDE. Furthermore, on COM4, there is nothing printed despite the Serial.println("Opening Serial Connection on COM4"); command which I think should work regardless of bluetooth.

I have tried everything I can think of. I would be grateful if anyone can help me solve this problem as I have been stuck for days

I am trying to connect ESP32 via bluetooth classic to my PC to transfer some data from a sensor.

As a first step, I am simply trying to send some random data over bluetooth serial. The code is at follows:

#include "BluetoothSerial.h"

#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif

int myData[8];
BluetoothSerial SerialBT;

void setup() {
  Serial.begin(115200);
  Serial.println("Opening Serial Connection on COM4");
  SerialBT.begin("ESP32"); //Bluetooth device name
  SerialBT.println("Opening Serial Bluetooth Connection on COM6");

}

void loop() {

  for(int i = 0; i < 8; i++)
  {
    myData[i] = random(0,500);
  }
  if(Serial.available())
    {
 
     for(int i = 0; i < 8; i++)
  {
    SerialBT.write(myData[i]);
  }
      
    }
    delay(20);
}

In Windows Bluetooth settings, I have paired the ESP32 with windows and connected it. I have set up incoming and outgoing COM ports for Bluetooth where incoming port is COM6 and outgoing port is COM5.

However, when I open the Arduino serial monitor for COM6, it is empty and no data is being printed. I am using the Arduino IDE. Furthermore, on COM4, there is nothing printed despite the Serial.println("Opening Serial Connection on COM4"); command which I think should work regardless of Bluetooth.

I have tried everything I can think of. I would be grateful if anyone can help me solve this problem as I have been stuck for days.

Source Link
Erik
  • 1
  • 1

Problem with ESP32 bluetooth

I am trying to connect ESP32 via bluetooth classic to my PC to transfer some data from a sensor.

As a first step, I am simply trying to send some random data over bluetooth serial. The code is at follows:

#include "BluetoothSerial.h"

#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif

int myData[8];
BluetoothSerial SerialBT;

void setup() {
  Serial.begin(115200);
  Serial.println("Opening Serial Connection on COM4");
  SerialBT.begin("ESP32"); //Bluetooth device name
  SerialBT.println("Opening Serial Bluetooth Connection on COM6");

 
}

void loop() {

  for(int i = 0; i < 8; i++)
  {
    myData[i] = random(0,500);
  }
  if(Serial.available())
    {
 
     for(int i = 0; i < 8; i++)
  {
    SerialBT.write(myData[i]);
  }
   
     
    }
    delay(20);
}

In Windows bluetooth settings, I have paired the ESP32 with windows and connected it. I have set up incoming and outgoing COM ports for bluetooth where incoming port is COM6 and outgoing port is COM5.

However, when I open arduino serial monitor for COM6, it is empty and no data is being printed. I am using arduino IDE. Furthermore, on COM4, there is nothing printed despite the Serial.println("Opening Serial Connection on COM4"); command which I think should work regardless of bluetooth.

I have tried everything I can think of. I would be grateful if anyone can help me solve this problem as I have been stuck for days