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"

#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it

int myData[8];
BluetoothSerial SerialBT;

void setup() {
  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);
     for(int i = 0; i < 8; i++)

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.