EasyManuals Logo

Freenove ESP32 User Manual

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
Page #128 background imageLoading...
Page #128 background image
Need support? support@freenove.com
126
Chapter 13 BLE
www.freenove.com
BLE Bluetooth initialization function.
6
bleSetup();
BLE Bluetooth send data function.
11
bleSend(buf);
Bluetooth low energy data receiving function.
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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.
}
}
}
}
BluetoothService.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef __BLUETOOTHSERVICE_H
#define __BLUETOOTHSERVICE_H
#include "Arduino.h"
#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>
#include <BLE2902.h>
class BLEServer;
class BLECharacteristic;
class BLEServerCallbacks;
void bleSetup();
void bleStop();
void bleSend(std::string msg);
extern void onBleReceived(BLECharacteristic *pCharacteristic);
#endif

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Freenove ESP32 and is the answer not in the manual?

Freenove ESP32 Specifications

General IconGeneral
BrandFreenove
ModelESP32
CategoryComputer Hardware
LanguageEnglish

Related product manuals