Can you not decode those on your computer? When you use Strings it's very likely that the value itself will be very long (like 56.23435 or similar). When sending advertising data you're limited to around 20 bytes in total, so if you send two of those, there may be too much data and setAdvertising will fail - which might explain the problems you were having.
For example if the battery is 56.5 in one instance then it might be fine, but if it's 56.23435 the next then it could fail.
For instant i didn´t understand how to perform the multi beacon variant (ibacon and eddison)
There are specific pages on iBeacon and Eddystone:
Did you see those? The configuration you should use it detailed there - the get function is used just the same as if you did the initial require("ble_ibeacon").advertise.
It even has an example that does exactly what you're asking - I've just copy/pasted in the arguments from advertise for you:
NRF.setAdvertising([
require("ble_ibeacon").get({
uuid : [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // ibeacon uuid
major : 0x0001, // optional
minor : 0x0001, // optional
rssi : -59 // optional RSSI at 1 meter distance in dBm
}),
require("ble_eddystone").get("your_url")
], {interval:100});
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Can you not decode those on your computer? When you use Strings it's very likely that the value itself will be very long (like
56.23435
or similar). When sending advertising data you're limited to around 20 bytes in total, so if you send two of those, there may be too much data andsetAdvertising
will fail - which might explain the problems you were having.For example if the battery is
56.5
in one instance then it might be fine, but if it's56.23435
the next then it could fail.There are specific pages on iBeacon and Eddystone:
http://www.espruino.com/Puck.js+Eddystone and http://www.espruino.com/Puck.js+iBeacon
Did you see those? The configuration you should use it detailed there - the
get
function is used just the same as if you did the initialrequire("ble_ibeacon").advertise
.It even has an example that does exactly what you're asking - I've just copy/pasted in the arguments from
advertise
for you: