-2

I'm trying to include the thing...

#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>
#include <BLE2902.h>

BLEServer* pServer = NULL;

void setup() { // put your setup code here, to run once:

}

void loop() { // put your main code here, to run repeatedly:

}

But it simply doesn't see what's inside the .h files:

C:\Users\void\AppData\Local\Temp\.arduinoIDE-unsaved20231028-7016-1na7gr9.y1do\sketch_nov28b\sketch_nov28b.ino:6:1: error: 'BLEServer' does not name a type; did you mean 'Server'?
 BLEServer* pServer = NULL;                        // Pointer to the server
 ^~~~~~~~~
 Server

May it be, I bought the wrong board? I've set it as lolin s2 mini.

enter image description here

The Void
  • 1
  • 2

1 Answers1

1

Many of the ESP32 variants have Bluetooth/BLE support. The ESP32-S2 board/module you're trying to use does not. The module has WiFi, but not Bluetooth.

Crop from original board image showing S2 markings highlighted.

So you need another board, Lolin seems to have an -S3 version of your board. But many other boards would work.

The majority of the <BLEServer.h> header's contents are conditionally compiled based on whether or not CONFIG_BLUEDROID_ENABLED is #defined.

And this only done for modules that have support for Bluetooth. The Lolin S3 version of the Mini would have Bluetooth support and in the configuration file it would use you can see it defined. In the one for the S2 board you are trying to use it is missing.

In effect, although you're including the header, it is as though it were blank. So no definition of the BLEServer type. It would have been nice if they'd handled this a different way, but this is not uncommon.

timemage
  • 5,639
  • 1
  • 14
  • 25