tidy
This commit is contained in:
parent
02ec97d557
commit
451b71758a
@ -15,7 +15,6 @@ typedef struct
|
|||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
BLEDevice::init(""); // Initialize BLE device
|
BLEDevice::init(""); // Initialize BLE device
|
||||||
Serial.println("Scanning...");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char currentName[128];
|
char currentName[128];
|
||||||
@ -23,11 +22,14 @@ bool gotBasicInfo;
|
|||||||
bool gotCellInfo;
|
bool gotCellInfo;
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
Serial.printf("\r\n\r\n===============================\r\n\r\n");
|
||||||
|
|
||||||
|
Serial.println("Scanning...");
|
||||||
|
|
||||||
BLEScan* pBLEScan = BLEDevice::getScan(); // Create new scan
|
BLEScan* pBLEScan = BLEDevice::getScan(); // Create new scan
|
||||||
pBLEScan->setActiveScan(true); // Active scan uses more power, but get results faster
|
pBLEScan->setActiveScan(true); // Active scan uses more power, but get results faster
|
||||||
BLEScanResults foundDevices = pBLEScan->start(10); //seconds
|
BLEScanResults foundDevices = pBLEScan->start(10); //seconds
|
||||||
|
|
||||||
Serial.println("Scanning completed");
|
|
||||||
Serial.println("Devices found: " + String(foundDevices.getCount()));
|
Serial.println("Devices found: " + String(foundDevices.getCount()));
|
||||||
|
|
||||||
for (int i = 0; i < foundDevices.getCount(); i++) {
|
for (int i = 0; i < foundDevices.getCount(); i++) {
|
||||||
@ -42,7 +44,7 @@ void loop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BLEClient* pClient = BLEDevice::createClient();
|
BLEClient* pClient = BLEDevice::createClient();
|
||||||
Serial.println("Connecting to: " + String(advertisedDevice.getAddress().toString().c_str()));
|
Serial.println("Connecting to: " + String(advertisedDevice.getName().c_str()));
|
||||||
|
|
||||||
if(!pClient->connect(&advertisedDevice)) {
|
if(!pClient->connect(&advertisedDevice)) {
|
||||||
Serial.println("Failed to connect.");
|
Serial.println("Failed to connect.");
|
||||||
|
Loading…
Reference in New Issue
Block a user