I am making Indoor positioning system project and I am using 3 Qty ESP8266 device. I tried your code but It is not working. Did you make anything change? Please Can you help me about this topic?
Please Can you help me? I have ESP32 WROOM32-U device. Also I select to device like below picture. Also I am using 1.0.2 version of ESP32. I tried with lst version(1.0.6) but It didn't work
Code :
/
Based on Neil Kolban example for IDF: https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLE%20Tests/SampleScan.cpp
Ported to Arduino ESP32 by Evandro Copercini
/
include
include
include
include
//UUIDs of what server we want to filtering.
static BLEUUID serviceUUID_A("0000fdee-0000-1000-8000-00805f9b34fb");
static BLEUUID serviceUUID_B("4fafc201-1fb5-459e-8fcc-c5c9c331914b");
static BLEUUID serviceUUID_C("407fc20d-d5f5-4176-bb4d-cc9c1968f9f6");
static BLEUUID serviceUUID_D("14fb4533-1997-4bbe-a567-554d2da89738");
//Set scanTime to forever "scanTime = 0".
int scanTime = 0; //In seconds
//Function when found device and can use in void loop(); for do other things.
class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks {
void onResult(BLEAdvertisedDevice advertisedDevice) {
if (advertisedDevice.isAdvertisingService(serviceUUID_A)) {
if (Scan_A == NULL) {
Found_A = true;
Scan_A = new BLEAdvertisedDevice(advertisedDevice);
}
}
if (advertisedDevice.isAdvertisingService(serviceUUID_B)) {
if (Scan_B == NULL) {
Found_B = true;
Scan_B = new BLEAdvertisedDevice(advertisedDevice);
}
}
}
I am making Indoor positioning system project and I am using 3 Qty ESP8266 device. I tried your code but It is not working. Did you make anything change? Please Can you help me about this topic? Please Can you help me? I have ESP32 WROOM32-U device. Also I select to device like below picture. Also I am using 1.0.2 version of ESP32. I tried with lst version(1.0.6) but It didn't work Code : / Based on Neil Kolban example for IDF: https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLE%20Tests/SampleScan.cpp Ported to Arduino ESP32 by Evandro Copercini /
include
include
include
include
//UUIDs of what server we want to filtering. static BLEUUID serviceUUID_A("0000fdee-0000-1000-8000-00805f9b34fb"); static BLEUUID serviceUUID_B("4fafc201-1fb5-459e-8fcc-c5c9c331914b"); static BLEUUID serviceUUID_C("407fc20d-d5f5-4176-bb4d-cc9c1968f9f6"); static BLEUUID serviceUUID_D("14fb4533-1997-4bbe-a567-554d2da89738");
//Set "Scan_x" for condition statement. static BLEAdvertisedDevice Scan_A ; static BLEAdvertisedDevice Scan_B ;
//Set "Found_x" for condition statement. static bool Found_A = false; static bool Found_B = false;
//Set scanTime to forever "scanTime = 0". int scanTime = 0; //In seconds
//Function when found device and can use in void loop(); for do other things. class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks { void onResult(BLEAdvertisedDevice advertisedDevice) { if (advertisedDevice.isAdvertisingService(serviceUUID_A)) {
};
void setup() { Serial.begin(115200); Serial.println("Scanning...");
BLEDevice::init(""); BLEScan* pBLEScan = BLEDevice::getScan(); //create new scan pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks()); pBLEScan->setActiveScan(true); //active scan uses more power, but get results faster pBLEScan->start(scanTime); }
void loop() { if (Found_A) { int Rssi_A = Scan_A->getRSSI(); Serial.printf("RSSI A: %d \t", Rssi_A); delete Scan_A; Scan_A = NULL; Found_A = false; delay(500); }
if (Found_B) { int Rssi_B = Scan_B->getRSSI(); Serial.printf("RSSI B: %d \t", Rssi_B); delete Scan_B; Scan_B = NULL; Found_B = false; delay(500); } Serial.print("\n"); delay(1000); }