var presses = 0;
function updateAdvertising() {
NRF.setAdvertising({},{manufacturer: 0x0590, manufacturerData:[presses,E.getTemperature()]});
}
setWatch(function() {
presses++;
updateAdvertising();
}, BTN, {edge:"rising", repeat:1, debounce:20});
// update advertising with new temperature once a minute
setInterval(updateAdvertising, 60000);
// update advertising right now
updateAdvertising();
And then use the code from https://www.espruino.com/BLE+Advertising#node-js - either JS or Python. The first byte you get will be the button press count - so when it changes you can do your HTTP request - and the second byte is the temperature, so there's no need to request it - you just always have it available.
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.
So you're running the code from this example? https://www.espruino.com/Interfacing#node-js-javascript
It seems that maybe it's trying to connect to the device twice, so you could try changing the code right at the top to:
Does the code make the Puck's light flash?
The best bet there is to use https://www.espruino.com/BLE+Advertising
So on the Puck:
And then use the code from https://www.espruino.com/BLE+Advertising#node-js - either JS or Python. The first byte you get will be the button press count - so when it changes you can do your HTTP request - and the second byte is the temperature, so there's no need to request it - you just always have it available.