// test temperature
var C = {
every_30_sec : 30000,
setTemp : NRF.setServices,
updateTemp : NRF.updateServices,
};
function publishTemp(fn) {
digitalPulse(LED2, 1, 200);
fn({
0x1809 : { // Health Thermometer
0x2A6E: {
readable: true,
broadcast: true,
value : [E.getTemperature().toFixed(2)]
}}});
}
// first time
publishTemp(C.setTemp);
// every 30 sec
setInterval(publishTemp,C.every_30_sec,C.updateTemp);
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.
or a shorter one