EasyManua.ls Logo

Freenove ESP32

Default Icon
159 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Need support? support@freenove.com
125
Chapter 13 BLE
www.freenove.com
BLE Bluetooth data transparent transmission routine:
The following is the code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "BluetoothService.h"
void setup() {
Serial.begin(115200);
Serial.println("\n\nProgram begin ... ");
bleSetup();
}
void loop() {
std::string buf = "I#8400#100\nI";
bleSend(buf);
delay(3000);
}
void onBleReceived(BLECharacteristic *pCharacteristic) {
std::string rxValue = pCharacteristic->getValue();
static String bleInputString = "";
Serial.print("onBleReceived: ");
if (rxValue.length() > 0) {
for (int i = 0; i < rxValue.length(); i++) {
bleInputString += rxValue[i];
if (rxValue[i] == '\n') {
Serial.println(bleInputString);
/*You can do something with the information you receive*/
bleInputString = ""; //Clear bleInputString.
}
}
}
}

Related product manuals