• or a shorter one

    // 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);
    
    
About

Avatar for MaBe @MaBe started