AT Commands - Variable Parameter

Dear All,

I am using an AT command to set the URL of an Eddystone beacon using an Adafruit BlueFruit, this works fine:

#define URL "http://www.christmas.com"

ble.sendCommandCheckOK(F( "AT+EDDYSTONEURL=" URL ));

But I don't want a fixed URL, I want the URL to be set inside the android code like this:

String URLString;

URLString = "http://www.christmas.com";

ble.sendCommandCheckOK(F( "AT+EDDYSTONEURL=" URLString ));

But this doesn't work, the compiler reports:

  • expected ')' before 'URLString'
  • #define PSTR(str) (str)

Please help...I can't define the URL as a constant, I need to create it as a string.

The ble commands are drawn from Adafruit_BLE.h

I'm not that familiar with the Adafruit product range so I have no idea what an 'Adafruit Eddystone beacon' is without going looking for it, which I am not inclined to do. Also the lack of code, links to libraries, etc, means that as it stands only someone who has experienced exactly the same problem as you will be able to help.

So, as a pure guess, lose the 'F' macro so it doesn't get stored in Flash memory, and you may have to play around with string concatenation to crate a single variable to pass to 'ble.sendCommandCheckOK'.