-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

2
  • The thing.....? Commented Nov 28, 2023 at 13:37
  • Yes, the thing!
    – The Void
    Commented Nov 28, 2023 at 16:02

1 Answer 1

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.

2
  • They told me it supports BLE... Thank you anyway.
    – The Void
    Commented Nov 28, 2023 at 15:27
  • LOL. I understand the frustration. I wouldn't put it quite that way though. That same group of people also makes the datasheets. While their technical documentation is something I've railed about before, there's no mention of Bluetooth/BLE in the ESP32S2 datasheet. I'd be surprised if Expressif would tell you they support BLE support. Ebay/alibaba/amazon-markplace/dx/etc/etc, not so much.
    – timemage
    Commented Nov 28, 2023 at 15:43

Not the answer you're looking for? Browse other questions tagged or ask your own question.