SparkFun Forums 

Where electronics enthusiasts find answers.

Topics pertaining to the Arduino Core & software used with the Artemis module and Artemis development boards.
User avatar
By brandensws
#241665
We are trying to follow the example for this ESP32 but run it on the Artemis.

https://learn.sparkfun.com/tutorials/se ... 1684945444

We have an Artemis Nano and we have installed Arduino IDE 1.8.12 per the "https://learn.sparkfun.com/tutorials/ar ... rduino-ide" and we believe we installed the correct BLE library from here "https://github.com/arduino-libraries/ArduinoBLE" but when compiling the code we get errors that are below. I'm open to doing this a different way if there is a better way of doing it, but I'm kind of at a loss.

Thanks

Arduino: 1.8.12 (Windows 10), Board: "RedBoard Artemis Nano, 460800, SparkFun Variable Loader (Recommended)"

Client_BLE:8:2: error: stray '#' in program
W#include "BLEDevice.h"
^
Client_BLE:8:1: error: 'W' does not name a type
W#include "BLEDevice.h"
^
Client_BLE:14:8: error: 'BLEUUID' does not name a type; did you mean 'BLEIF'?
static BLEUUID charUUID("beb5483e-36e1-4688-b7f5-ea07361b26a8");
^~~~~~~
BLEIF
Client_BLE:15:8: error: 'BLEUUID' does not name a type; did you mean 'BLEIF'?
static BLEUUID charAccXUUID("fb6cf981-31cc-4f36-af06-1f2f3e919840");// use the same UUID as on the server
^~~~~~~
BLEIF
Client_BLE:16:8: error: 'BLEUUID' does not name a type; did you mean 'BLEIF'?
static BLEUUID charAccYUUID("35b17f66-73d1-4c92-92f6-9032ef1987d3");
^~~~~~~
BLEIF
Client_BLE:17:8: error: 'BLEUUID' does not name a type; did you mean 'BLEIF'?
static BLEUUID charAccZUUID("3cab9341-e65b-46e9-83ed-c8a7f2f841c2");
^~~~~~~
BLEIF
Client_BLE:22:8: error: 'BLERemoteCharacteristic' does not name a type
static BLERemoteCharacteristic* pRemoteCharacteristic;
^~~~~~~~~~~~~~~~~~~~~~~
Client_BLE:23:8: error: 'BLERemoteCharacteristic' does not name a type
static BLERemoteCharacteristic* pRemoteCharacteristicACCx;
^~~~~~~~~~~~~~~~~~~~~~~
Client_BLE:24:8: error: 'BLERemoteCharacteristic' does not name a type
static BLERemoteCharacteristic* pRemoteCharacteristicACCy;
^~~~~~~~~~~~~~~~~~~~~~~
Client_BLE:25:8: error: 'BLERemoteCharacteristic' does not name a type
static BLERemoteCharacteristic* pRemoteCharacteristicACCz;
^~~~~~~~~~~~~~~~~~~~~~~
Client_BLE:26:8: error: 'BLEAdvertisedDevice' does not name a type
static BLEAdvertisedDevice* myDevice;
^~~~~~~~~~~~~~~~~~~
Client_BLE:28:29: error: variable or field 'notifyCallback' declared void
static void notifyCallback(
^
Client_BLE:28:29: error: 'BLERemoteCharacteristic' was not declared in this scope
Client_BLE:28:54: error: 'pBLERemoteCharacteristic' was not declared in this scope
static void notifyCallback(
^
Client_BLE:28:87: error: expected primary-expression before '*' token
static void notifyCallback(
^
Client_BLE:28:89: error: 'pData' was not declared in this scope
static void notifyCallback(
^
Client_BLE:28:103: error: expected primary-expression before 'length'
static void notifyCallback(
^
Client_BLE:28:111: error: expected primary-expression before 'bool'
static void notifyCallback(
^
Client_BLE:29:3: error: variable or field 'notifyCallback' declared void
BLERemoteCharacteristic* pBLERemoteCharacteristic,
^~~~~~~~~~~~~~~~~~~~~~~
Client_BLE:29:3: error: 'BLERemoteCharacteristic' was not declared in this scope
Client_BLE:29:28: error: 'pBLERemoteCharacteristic' was not declared in this scope
BLERemoteCharacteristic* pBLERemoteCharacteristic,
^~~~~~~~~~~~~~~~~~~~~~~~
Client_BLE:30:10: error: expected primary-expression before '*' token
uint8_t* pData,
^
Client_BLE:30:12: error: 'pData' was not declared in this scope
uint8_t* pData,
^~~~~
Client_BLE:31:10: error: expected primary-expression before 'length'
size_t length,
^~~~~~
Client_BLE:32:3: error: expected primary-expression before 'bool'
bool isNotify) {
^~~~
Client_BLE:41:52: error: expected class-name before '{' token
class MyClientCallback : public BLEClientCallbacks {
^
Client_BLE:42:18: error: 'BLEClient' has not been declared
void onConnect(BLEClient* pclient) {
^~~~~~~~~
Client_BLE:45:21: error: 'BLEClient' has not been declared
void onDisconnect(BLEClient* pclient) {
^~~~~~~~~
C:\Arduino\SparkFun\Client_BLE\Client_BLE.ino: In function 'bool connectToServer()':
Client_BLE:53:20: error: 'myDevice' was not declared in this scope
Serial.println(myDevice->getAddress().toString().c_str());
^~~~~~~~
Client_BLE:55:5: error: 'BLEClient' was not declared in this scope
BLEClient* pClient = BLEDevice::createClient();
^~~~~~~~~
C:\Arduino\SparkFun\Client_BLE\Client_BLE.ino:55:5: note: suggested alternative: 'DNSClient'
BLEClient* pClient = BLEDevice::createClient();
^~~~~~~~~
DNSClient
Client_BLE:55:17: error: 'pClient' was not declared in this scope
BLEClient* pClient = BLEDevice::createClient();
^~~~~~~
C:\Arduino\SparkFun\Client_BLE\Client_BLE.ino:55:17: note: suggested alternative: 'DNSClient'
BLEClient* pClient = BLEDevice::createClient();
^~~~~~~
DNSClient
Client_BLE:55:28: error: 'BLEDevice' has not been declared
BLEClient* pClient = BLEDevice::createClient();
^~~~~~~~~
Client_BLE:66:5: error: 'BLERemoteService' was not declared in this scope
BLERemoteService* pRemoteService = pClient->getService(serviceUUID);
^~~~~~~~~~~~~~~~
Client_BLE:66:23: error: 'pRemoteService' was not declared in this scope
BLERemoteService* pRemoteService = pClient->getService(serviceUUID);
^~~~~~~~~~~~~~
Client_BLE:66:60: error: 'serviceUUID' was not declared in this scope
BLERemoteService* pRemoteService = pClient->getService(serviceUUID);
^~~~~~~~~~~
Client_BLE:76:5: error: 'pRemoteCharacteristic' was not declared in this scope
pRemoteCharacteristic = pRemoteService->getCharacteristic(charUUID);
^~~~~~~~~~~~~~~~~~~~~
Client_BLE:76:63: error: 'charUUID' was not declared in this scope
pRemoteCharacteristic = pRemoteService->getCharacteristic(charUUID);
^~~~~~~~
C:\Arduino\SparkFun\Client_BLE\Client_BLE.ino:76:63: note: suggested alternative: 'char'
pRemoteCharacteristic = pRemoteService->getCharacteristic(charUUID);
^~~~~~~~
char
Client_BLE:85:5: error: 'pRemoteCharacteristicACCx' was not declared in this scope
pRemoteCharacteristicACCx = pRemoteService->getCharacteristic(charAccXUUID);
^~~~~~~~~~~~~~~~~~~~~~~~~
Client_BLE:85:67: error: 'charAccXUUID' was not declared in this scope
pRemoteCharacteristicACCx = pRemoteService->getCharacteristic(charAccXUUID);
^~~~~~~~~~~~
Client_BLE:94:5: error: 'pRemoteCharacteristicACCy' was not declared in this scope
pRemoteCharacteristicACCy = pRemoteService->getCharacteristic(charAccYUUID);
^~~~~~~~~~~~~~~~~~~~~~~~~
Client_BLE:94:67: error: 'charAccYUUID' was not declared in this scope
pRemoteCharacteristicACCy = pRemoteService->getCharacteristic(charAccYUUID);
^~~~~~~~~~~~
Client_BLE:103:5: error: 'pRemoteCharacteristicACCz' was not declared in this scope
pRemoteCharacteristicACCz = pRemoteService->getCharacteristic(charAccZUUID);
^~~~~~~~~~~~~~~~~~~~~~~~~
Client_BLE:103:67: error: 'charAccZUUID' was not declared in this scope
pRemoteCharacteristicACCz = pRemoteService->getCharacteristic(charAccZUUID);
^~~~~~~~~~~~
Client_BLE:119:48: error: 'notifyCallback' was not declared in this scope
pRemoteCharacteristic->registerForNotify(notifyCallback);
^~~~~~~~~~~~~~
C:\Arduino\SparkFun\Client_BLE\Client_BLE.ino:119:48: note: suggested alternative: 'MyClientCallback'
pRemoteCharacteristic->registerForNotify(notifyCallback);
^~~~~~~~~~~~~~
MyClientCallback
C:\Arduino\SparkFun\Client_BLE\Client_BLE.ino: At global scope:
Client_BLE:127:72: error: expected class-name before '{' token
class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks {
^
Client_BLE:131:17: error: 'BLEAdvertisedDevice' has not been declared
void onResult(BLEAdvertisedDevice advertisedDevice) {
^~~~~~~~~~~~~~~~~~~
C:\Arduino\SparkFun\Client_BLE\Client_BLE.ino: In member function 'void MyAdvertisedDeviceCallbacks::onResult(int)':
Client_BLE:133:37: error: request for member 'toString' in 'advertisedDevice', which is of non-class type 'int'
Serial.println(advertisedDevice.toString().c_str());
^~~~~~~~
Client_BLE:136:26: error: request for member 'haveServiceUUID' in 'advertisedDevice', which is of non-class type 'int'
if (advertisedDevice.haveServiceUUID() && advertisedDevice.isAdvertisingService(serviceUUID)) {
^~~~~~~~~~~~~~~
Client_BLE:136:64: error: request for member 'isAdvertisingService' in 'advertisedDevice', which is of non-class type 'int'
if (advertisedDevice.haveServiceUUID() && advertisedDevice.isAdvertisingService(serviceUUID)) {
^~~~~~~~~~~~~~~~~~~~
Client_BLE:136:85: error: 'serviceUUID' was not declared in this scope
if (advertisedDevice.haveServiceUUID() && advertisedDevice.isAdvertisingService(serviceUUID)) {
^~~~~~~~~~~
Client_BLE:138:7: error: 'BLEDevice' has not been declared
BLEDevice::getScan()->stop();
^~~~~~~~~
Client_BLE:139:7: error: 'myDevice' was not declared in this scope
myDevice = new BLEAdvertisedDevice(advertisedDevice);
^~~~~~~~
Client_BLE:139:22: error: expected type-specifier before 'BLEAdvertisedDevice'
myDevice = new BLEAdvertisedDevice(advertisedDevice);
^~~~~~~~~~~~~~~~~~~
C:\Arduino\SparkFun\Client_BLE\Client_BLE.ino: In function 'void setup()':
Client_BLE:151:3: error: 'BLEDevice' has not been declared
BLEDevice::init("");
^~~~~~~~~
Client_BLE:156:3: error: 'BLEScan' was not declared in this scope
BLEScan* pBLEScan = BLEDevice::getScan();
^~~~~~~
C:\Arduino\SparkFun\Client_BLE\Client_BLE.ino:156:3: note: suggested alternative: 'doScan'
BLEScan* pBLEScan = BLEDevice::getScan();
^~~~~~~
doScan
Client_BLE:156:12: error: 'pBLEScan' was not declared in this scope
BLEScan* pBLEScan = BLEDevice::getScan();
^~~~~~~~
C:\Arduino\SparkFun\Client_BLE\Client_BLE.ino:156:12: note: suggested alternative: 'doScan'
BLEScan* pBLEScan = BLEDevice::getScan();
^~~~~~~~
doScan
Client_BLE:156:23: error: 'BLEDevice' has not been declared
BLEScan* pBLEScan = BLEDevice::getScan();
^~~~~~~~~
C:\Arduino\SparkFun\Client_BLE\Client_BLE.ino: In function 'void loop()':
Client_BLE:189:5: error: 'BLEDevice' has not been declared
BLEDevice::getScan()->start(0); // this is just example to start scan after disconnect, most likely there is better way to do it in arduino
^~~~~~~~~
Client_BLE:195:16: error: 'pRemoteCharacteristicACCx' was not declared in this scope
float XValue = pRemoteCharacteristicACCx->readFloat();
^~~~~~~~~~~~~~~~~~~~~~~~~
Client_BLE:196:16: error: 'pRemoteCharacteristicACCy' was not declared in this scope
float YValue = pRemoteCharacteristicACCy->readFloat();
^~~~~~~~~~~~~~~~~~~~~~~~~
Client_BLE:197:16: error: 'pRemoteCharacteristicACCz' was not declared in this scope
float ZValue = pRemoteCharacteristicACCz->readFloat();
^~~~~~~~~~~~~~~~~~~~~~~~~
exit status 1
stray '#' in program

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
By paulvha
#241667
The error is the 'W' before
Code: Select all
W#include "BLEDevice.h"
Remove that.

But you could better start with an example of ArduinoBLE than trying an example of an ESP32. The syntax is just a little different on different places.
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum