This library is based on ESP32 master BLE applications. It can connect 4 slave devices at the same time, and can connect different Bluetooth through setting different service ID. At the same time, an example of combining WiFi and BLE is also given.
Download the directory "DFRobot_ESP32_WiFiBLE » and move it into the "libraries" directory inside your sketchbook directory, then restart the Arduino IDE. You will then see it listed under File->Examples->DFRobot_ESP32_WiFiBLE.
The library is instantiated as an object with BLE provided to read and write data from BLE.
DFRobot_ESP32_BLE ble;
Setting up peripheral service ID.
Example:
ble.setService(0xdfb0);
0xdfb0 is the serive ID for Bluno, so you can connect Bluno.
Setting up peripheral Characteristic.
Example:
ble.setCharacteristic(0xdfb1);
0xdfb0 is the Characteristic number for Bluno, so you can connect Bluno.
Sets the number of connections from the machine
Example:
ble.setconnummax(2);
The max conncect number is 2.
Setting up peripheral's name,which serive will connected.
Example:
ble.setconnectname0("Bluno0");
Initalize ESP32 BLE device.
Example:
ble.init();
Start running Bluetooth device
Example:
ble.begin();
Read data from BLE.
Example:
char dataName[15] = {'\0'};
String bledata = ble.readdata(dataName);