The two things will work fine together - Puck.js has a bunch of different interrupt sources and chooses them such that they don't conflict.
However probably what you're hitting is that setAdvertising isn't additive - so when you call the button one you'll end up removing the 0x1821 service that the tilt listener added?
Easiest thing to do is to create one function called updateAdvertising that sets everything, and then call that whenever something changes.
Also just FYI, but swapBlue/etc can be replaced with LED3.toggle() if you want to swap the LED state
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 two things will work fine together - Puck.js has a bunch of different interrupt sources and chooses them such that they don't conflict.
However probably what you're hitting is that
setAdvertising
isn't additive - so when you call the button one you'll end up removing the0x1821
service that the tilt listener added?Easiest thing to do is to create one function called
updateAdvertising
that sets everything, and then call that whenever something changes.Also just FYI, but
swapBlue
/etc can be replaced withLED3.toggle()
if you want to swap the LED state