Mango-kid / maciot

Board design and description of the MacIoT Educational Board
GNU General Public License v3.0
1 stars 1 forks source link

Cannot Run Bluetooth Scanner on MacIoT Board #1

Closed CallMeSwal closed 5 years ago

CallMeSwal commented 5 years ago

Hi,

I'm trying to run the following code on my MacIoT board, but I keep on running into an error. / 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

int scanTime = 5; //In seconds BLEScan* pBLEScan;

class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks { void onResult(BLEAdvertisedDevice advertisedDevice) { Serial.printf("Advertised Device: %s \n", advertisedDevice.toString().c_str()); } };

void setup() { Serial.begin(115200); Serial.println("Scanning...");

BLEDevice::init(""); pBLEScan = BLEDevice::getScan(); //create new scan pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks()); pBLEScan->setActiveScan(true); //active scan uses more power, but get results faster pBLEScan->setInterval(100); pBLEScan->setWindow(99); // less or equal setInterval value }

void loop() { // put your main code here, to run repeatedly: BLEScanResults foundDevices = pBLEScan->start(scanTime, false); Serial.print("Devices found: "); Serial.println(foundDevices.getCount()); Serial.println("Scan done!"); pBLEScan->clearResults(); // delete results fromBLEScan buffer to release memory delay(2000); }

Here is the error that I am getting: #error "C++ exception handling must be enabled within make menuconfig. See Compiler Options > Enable C++ Exceptions."

From my understanding, the Arduino IDE does not have this option.

Any help would be greatly appreciated!

Mango-kid commented 5 years ago

This error is not an issue related to the MacIot board. I would look into the Arduino port for the ESP32 device.

On Tue, Feb 12, 2019 at 9:18 PM mso797 notifications@github.com wrote:

Hi,

I'm trying to run the following code on my MacIoT board, but I keep on running into an error. / 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

int scanTime = 5; //In seconds BLEScan* pBLEScan;

class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks { void onResult(BLEAdvertisedDevice advertisedDevice) { Serial.printf("Advertised Device: %s \n", advertisedDevice.toString().c_str()); } };

void setup() { Serial.begin(115200); Serial.println("Scanning...");

BLEDevice::init(""); pBLEScan = BLEDevice::getScan(); //create new scan pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks()); pBLEScan->setActiveScan(true); //active scan uses more power, but get results faster pBLEScan->setInterval(100); pBLEScan->setWindow(99); // less or equal setInterval value }

void loop() { // put your main code here, to run repeatedly: BLEScanResults foundDevices = pBLEScan->start(scanTime, false); Serial.print("Devices found: "); Serial.println(foundDevices.getCount()); Serial.println("Scan done!"); pBLEScan->clearResults(); // delete results fromBLEScan buffer to release memory delay(2000); }

Here is the error that I am getting: #error "C++ exception handling must be enabled within make menuconfig. See Compiler Options > Enable C++ Exceptions."

From my understanding, the Arduino IDE does not have this option.

Any help would be greatly appreciated!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Mango-kid/maciot/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AFfhxj4Qn3eZqHwMu_g8_0fEStWNy4NWks5vM3X3gaJpZM4a4c_i .

CallMeSwal commented 5 years ago

Hi sorry, can you elaborate by the Arduino port? Do you mean the serial port?

Mango-kid commented 5 years ago

Sorry. I mean the Arduino software for ESP32. This can also be found on GitHub. You can post an issue their. It will have its own repository.

On Tue., Feb. 12, 2019, 10:15 p.m. mso797, notifications@github.com wrote:

Hi sorry, can you elaborate by the Arduino port? Do you mean the serial port?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Mango-kid/maciot/issues/1#issuecomment-463040051, or mute the thread https://github.com/notifications/unsubscribe-auth/AFfhxoHLf_u8qyNUMs9U7SNg3fDPzccBks5vM4NTgaJpZM4a4c_i .

CallMeSwal commented 5 years ago

The solution I find online is to use the esspressif ide(esp-idf) instead of the arduino ide. In that gui, there is the option "Compiler Options > Enable C++ Exceptions".

But from my understanding the MacIoT board exists for arduino only. I was wondering if there was a way I could use the MacIoT board in esp-idf instead of arduino ide?

Mango-kid commented 5 years ago

It will also work with the Esspresif IDE. You will have to upload code manually and also have some knowledge of the pins. If you are interested in programming it is a worthy pursuit, however there will be a learning curve.

On Tue., Feb. 12, 2019, 10:26 p.m. mso797, notifications@github.com wrote:

The solution I find online is to use the esspressif ide(esp-idf) instead of the arduino ide. In that gui, there is the option "Compiler Options > Enable C++ Exceptions".

But from my understanding the MacIoT board exists for arduino only. I was wondering if there was a way I could use the MacIoT board in esp-idf instead of arduino ide?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Mango-kid/maciot/issues/1#issuecomment-463042153, or mute the thread https://github.com/notifications/unsubscribe-auth/AFfhxgcP5WUYg9DyOj9Tpq_L9mf-mLsGks5vM4XOgaJpZM4a4c_i .

CallMeSwal commented 5 years ago

Ok, that's good to know. We're trying to setup a ble beacon demo. The MacIoT boards work fine as ble beacons, but I cannot get one to work as a scanner. As of right now, my plan is to just use a different board as the scanner.

I just want to make sure that there is no existing code or example where you use the MacIoT board as a BLE scanner? If there is, could you point me to it?

Mango-kid commented 5 years ago

Sorry now that I know of. Some other students had worked with BLE before but I am not sure who.

On Tue., Feb. 12, 2019, 10:33 p.m. mso797, notifications@github.com wrote:

Ok, that's good to know. We're trying to setup a ble beacon demo. The MacIoT boards work fine as ble beacons, but I cannot get one to work as a scanner. As of right now, my plan is to just use a different board as the scanner.

I just want to make sure that there is no existing code or example where you use the MacIoT board as a BLE scanner? If there is, could you point me to it?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Mango-kid/maciot/issues/1#issuecomment-463043540, or mute the thread https://github.com/notifications/unsubscribe-auth/AFfhxqPRlnqIwBlIDwMVKy0OucL-zsNfks5vM4eVgaJpZM4a4c_i .

CallMeSwal commented 5 years ago

Ok no worries, thanks for your help!