-
• #2
I guess it's because you're just running the code once, and also you're trying to output a value between 0 and 1 as an integer?
What about:
setInterval(function() { NRF.setAdvertising([ {0x181A : [Puck.light()*100]}], {interval:500} ); }, 500);
The example code on http://www.espruino.com/Reference#l_NRF_setAdvertising shows how you could report the temperature using setInterval as well.
-
• #3
Hi gordon
Thanks for your answer
I don't follow you. I've tried also to use theFloat32Array([Puck.light() * 100]).buffer
to eliminate this question of value between 0 à 1 as an integer. But the value I get, in the ADV_IND does not change neither !!
I've looked again at the http://www.espruino.com/Reference#l_NRF_setAdvertising but do no see really what is wrong in my code.
By the way I've not used the following code that is proposed in the puck.js API documentation because to me, the setInterval is redundant to the setAdvertising. The NRF.setAdvertising is already arming the advertising mechanism and their is no way to use a setInterval() to do the same again ...
I Am wrong ?setInterval(function() { NRF.setAdvertising({ 0x1809 : [Math.round(E.getTemperature())] }); }, 30000);
Vpl
-
• #4
to me, the setInterval is redundant to the setAdvertising
This is your problem.
Try the code I gave you or the code in the example, and see if it works.
If you call
setAdvertising
once then advertising data will be set, but it'll be set just once so the value will not change until you call it again. Hence the need forsetInterval
to update the advertising with new light values.
Hi
I'm testing the ADV_IND associated to a sensing service definition as follow
I've controlled that the service is well defined into the GATT
I receive ADV_IND perdiodically as expected
My problem is that the Service Data value does not change at all. Egal to 0 !!
I've check several things
The Puck.light() is Ok as the following code works fine
I've tried to replace the Puck.light() by
The value is not = 0 but does not change neither ..
Any idea ?
Other option to get this sensing value ?