The issue is that's a characteristic, not a standard service that is used with advertising. It's still broadcasting the data (as a 2 character string), it's just not being interpreted by the app.
if I want to make 1 min for website1 and 2 min for website 2?
Then you need to call setAdvertising every time you need to change it. Specifying 2 lines will advertise two websites at once.
function changeWebsite(url) {
NRF.setAdvertising([
require("ble_eddystone").get(url),
{
//this part is all the data I want to show using Hex ,
// can take examples from here https://www.bluetooth.com/specifications/gatt/characteristics/ - //right?
0x180F : [NRF.getBattery()],
0x1809 : [Math.round(E.getTemperature())]
}
],
//this is the default setting I can cahnge - right ? this is the only setting I can change from here
{
name : "David",
showName: true,
discoverable : true,
connectable : false,
scannable : true,
interval:100
});
}
setInterval(function() {
// every 3 minutes...
changeWebsite("http://www.david1.com");
// 2 minute later
setTimeout(function() {
changeWebsite("http://www.Danny1.com");
}, 60000);
}, 3*60000); // 3 minutes
the battery shown 3%
It's because NRF.getBattery() is returning a voltage (that of the voltage regulator) which is 3.3v. It gets converted to in integer, which is 3.
The module can't directly measure the voltage on V+, you need to make a potential divider for that and connect it to an analog input - there are a few examples on the forum.
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.
The issue is that's a characteristic, not a standard service that is used with advertising. It's still broadcasting the data (as a 2 character string), it's just not being interpreted by the app.
Then you need to call
setAdvertising
every time you need to change it. Specifying 2 lines will advertise two websites at once.It's because
NRF.getBattery()
is returning a voltage (that of the voltage regulator) which is 3.3v. It gets converted to in integer, which is 3.The module can't directly measure the voltage on V+, you need to make a potential divider for that and connect it to an analog input - there are a few examples on the forum.