\npart of your code, or just a copy/paste issue?
One thing that might be worth trying is
debounce:20just in case something odd is happening caused by the button contacts bouncing and queuing up lots of changes?
Could you also add something like
LED.set()at the beginning of the
LED.reset()at the end? The LED should flicker on if everything has worked, but if for whatever reason there was an error executing to the end of the code then the LED will stay on
OK thank you i'll try with "debounce:20" and the "LED.set() / LED.reset()" at the beginning / end of setWatch.
If i remove the "/n" the code does not work, must i remove it ?
Forget about the "\n" problem i have write it a te end of the code only and it works.
I keep you inform if the "advertising" data problem is not resolved.
Thank you !
Ahh - how are you uploading the code? I guess it's not from the IDE, but from your own Node.js app?
Could you try uploading the code in the Espruino Web IDE and see if it works? It could be that if you're uploading via your own app then there may be issues with flow control which mean that the code doesn't get uploaded correctly.
It can be easy enough to fix, but for now, to help track down the problem, uploading via the IDE would be worth trying.
Yes i upload it from node.js app.
I have tested with the flicker LED and it does not stuck ( when advertising data not working ).
The setWatch function seem to works fine, but the NRF.setAdvertising inside sometimes is not triggered..
Could you try checking with the
nRF connectapp on a phone?
It is possible it's something to do with your computer actually cacheing the manufacturerdata.
I just tried this here and your code works fine for me - albeit with huge amounts of extra counting because you don't have any debounce
Where is the button on the puk.js PCB? I cannot see a button anywhere.
@user67760, for future reference. please create a new topic in it's own thread when requesting new off topic subject matter, and especially when the thread has matured. This will also assist others, should they have the exact question, as your post title will contain the exact issue they are seeking the answer to.
re: 'Where is the button on the puk.js PCB?' (sic puk.js -> Puck.js)
Ref image half-way down page:
The button is activated as the case is compressed. Although not shown in the that image, the button is on the opposite side between D1 and D31, adjacent to the battery holder, opposite where the battery is inserted.
I have uploaded a script which set data on button click.
Here is the code :
It works fine but sometimes when i click the button.. noble.js does not scan any changed data.
However the data value has changed but not advertised. ( it means the setWatch function is working )
I think it's a problem in puck.js script updated.. maybe NRF.setAdvertising ?
It is a major problem for our application. Do you have any idea of what could cause this issue ?
Thank you !