-
• #2
Hi.
I want people will be able to see: name of the device, battery, temp
But you also want the URL to be shown as well?
I think the issue is you have some of the arguments in the wrong places, and also some you don't need. Try:
NRF.setAdvertising([ require("ble_eddystone").get("http://www.david.com"), { 0x180F : [NRF.getBattery()], 0x1809 : [Math.round(E.getTemperature())] } ], { name : "David", showName: true, discoverable : true, connectable : false, scannable : true, interval:100 });
This does seem to be reasonable well documented (including an example specifically onm showing battery percentage and eddystone) on http://www.espruino.com/Reference#l_NRF_setAdvertising
what is the different between discoverable \scannable - isn't all the same?
discoverable
is whether it can be seen by normal devices scanning for it.scannable
refers to 'scan response' - there is some advertising info that isn't sent out all the time, a device that's scanning has to 'ask' for it. That's what 'scan response' is.For what you're doing, you don't need a scan response.
if I disable showname - I will see every data except the devcie name - right?
Yes, correct.
maybe I'm using the wrong app on my phone ?
nRF Connect
is fine...when I just search using bluethhoth scan - I don't see the device at all.
If it's coming up with those errors then it may not be appearing. Also, you need to be disconnected from Bluetooth for the device to start advertising.
when I search using "BLE Scanner" - I see the device (without any information ) but when I press "Open url" - it redirect my to my site . but no name\temp - nothing.
Maybe try it with the new code I suggested.
However some older Espruino firmwares did have a problem when advertising using an even number of advertising packets. If you really can't upgrade the firmware (not even with the iOS/Android phone that you seem to be using with nRF Connect???) then you could try:
NRF.setAdvertising([ require("ble_eddystone").get("http://www.david.com"), { 0x180F : [NRF.getBattery()], 0x1809 : [Math.round(E.getTemperature())] }, { 0x180F : [NRF.getBattery()], 0x1809 : [Math.round(E.getTemperature())] } ], { name : "David", showName: true, discoverable : true, connectable : false, scannable : true, interval:100 });
when I use "nRF Connect" - I don't the name of the device just "Te" and the battery 3% temp 85
That'll be because of your old code - try with the updated code.
-
• #3
great
thank you
I think you can post the code you post here as an easy to understand example
or even first code jsut flahs it
much more easy to understand ....so see I understand it correct:
NRF.setAdvertising([ require("ble_eddystone").get("http://www.david.com"), { //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 });
so now:
I can see the device in bluetooth normal scan (see the name only and can't connect to it because of connectable : false)
I can see the data from "NRF-connect". which is what I wantThank you so so much for this!
- I'm tryin to play with this , and send more data
just for the test I want to test this Hex(Got this from https://www.bluetooth.com/specifications/gatt/characteristics/)
Age org.bluetooth.characteristic.age 0x2A80 GSS
and add this to the code:{//here I put the HEX data -https://www.bluetooth.com/specifications/gatt/characteristics/ 0x180F : [NRF.getBattery()], 0x1809 : [Math.round(E.getTemperature())], 0x2A80 : "15" }
in the NRF I can see battery\temp but not age -jsut Service Data without name - why?
just 20x2A80 0x31 0x35 (which is 15)
is it standart?also can I set the time of the ble_eddystone for showing 2 websites?
I did thisrequire("ble_eddystone").get("http://www.david1.com"), require("ble_eddystone").get("http://www.Danny1.com"),
if I want to make 1 min for website1 and 2 min for website 2?
and meanwhile it will send data every 1 sec ?
or I need to write a more complicated code for this ?also the battery shown 3%
is it because I'm connecting using USB to the V+ (5V) and not to the battery input?
can I know what the voltage I'm using ? beacuse I saw it can be power onwill work off of 2.5 to 16 volts
can I measure the input?
Thanks,
- I'm tryin to play with this , and send more data
-
• #4
just for the test I want to test this Hex (Got this from https://www.bluetooth.com/specifications/gatt/characteristics/)
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.
-
• #5
Thanks!
Hello ,
I have try and try but your support and documentation is not so understandble for first use....
I'm using MDBT42Q version 2.04 (because I can't update using windows computer).
this is what I want to do :
publish my device using BLE , so whenever people will scan they will se my device
simple as this
I want people will be able to see:
this is what I want to upload to the MDBT42Q (after reading 10 times on the support part)
but it doesn;t work
I get error
so when I upload this it is working :
why?
maybe I'm missing something so this are my questions about the code above:
discoverable \scannable - isn't all the same?
if I disable showname - I will see every data except the devcie name - right?
when I just search using bluethhoth scan - I don't see the device at all.
when I search using "BLE Scanner" - I see the device (without any information ) but when I press "Open url" - it redirect my to my site . but no name\temp - nothing.
when I use "nRF Connect" - I don't the name of the device just "Te" and the battery 3% temp 85
so what is wrong?
Thank you for your help!