You can use NRF.sleep() to stop advertising (and wake to wake it), but you're not going to be saving vast amounts of power. If you really want to do that I'd suggest just supplying an interval argument in the second parameter of setAdvertising and choosing a very low (~2 sec?) interval.
It'll have basically the same effect but it's still connectable, and you'll actually get an update of the data to 0, rather than your last received advertising being the last nonzero value.
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.
You can use
NRF.sleep()
to stop advertising (andwake
to wake it), but you're not going to be saving vast amounts of power. If you really want to do that I'd suggest just supplying aninterval
argument in the second parameter ofsetAdvertising
and choosing a very low (~2 sec?) interval.It'll have basically the same effect but it's still connectable, and you'll actually get an update of the data to 0, rather than your last received advertising being the last nonzero value.