Problems with sample iBeacon code


#1

Hey guys, I have been trying the sample iBeacon code provided on the reference page but flashing the code throws the following error : “expected constructor, destructor, or type conversion before ‘void’”. Does anyone know what I should do to get it up and running? Thanks so much!


#2

At what line count?
Also quoting the actual “offending” code line would also help :wink:
Can you show your code?

This builds for me

#include "Particle.h"

SYSTEM_MODE(MANUAL);

Serial1LogHandler log(115200, LOG_LEVEL_ALL);

void setup() {
    iBeacon beacon(1, 2, "9c1b8bdc-5548-4e32-8a78-b9f524131206", -55);
    BLE.advertise(beacon);
}

void loop() {
}

#3

Hey thanks for helping! I tried using your code and the errors are

ibeacon.ino: In function 'void setup()': ibeacon.ino:8:5: error: 'iBeacon' was not declared in this scope iBeacon beacon(1, 2, "9c1b8bdc-5548-4e32-8a78-b9f524131206", -55); ^ ibeacon.ino:9:5: error: 'BLE' was not declared in this scope BLE.advertise(beacon); ^ ibeacon.ino:9:19: error: 'beacon' was not declared in this scope BLE.advertise(beacon);

The code that I used was:

#include "Particle.h"
template<typename T>
iBeacon(uint16_t major, uint16_t minor, T uuid, int8_t measurePower)
// EXAMPLE
void setup() {
    iBeacon beacon(1, 2, "9c1b8bdc-5548-4e32-8a78-b9f524131206", -55);
    BLE.advertise(beacon);
}

void loop() {
}

The error was thrown at
ibeacon.ino:5:1: expected constructor, destructor, or type conversion before 'void'.

I have been trying to upload it on an Argon (firmware 1.1.1), hope that helps!

Zhide


#4

BLE and NFC features are not supported prior to 1.3.0-rc.1

BTW, anyhting above // EXAMPLE is not part of the example either :wink:


#5

:man_facepalming: I see, thanks so much for being patient with a noob like me!