You are reading a single comment by @furuskog and its replies. Click here to read the full conversation.
  • @Wilberforce thank you very much for the help. With a little googling and some other tutorials about the sensor in python I finally had success.

    This is the code I used to get the correct values.

    var currentSevice = false;
    
        function getData() {
          var gatt;
          NRF.connect("C4:7C:8D:62:0D:5A").then(function(g) {
            gatt = g;
            return gatt.getPrimaryService("00001204-0000-1000-8000-00805f9b34fb");
          })
          .then(function(service) {
            currentService = service;
            return service.getCharacteristic("00001a00-0000-1000-8000-00805f9b34fb");
         })
         .then(function(characteristic) {
             return characteristic.writeValue([0xa0, 0x1f]);
         })
         .then(() => {
             return currentService.getCharacteristic("00001a01-0000-1000-8000-00805f9b34fb");
         })
         .then((characteristic) => {
            return characteristic.readValue();
         })
         .then(function(value) {
            console.log("temperature: ", value.getInt16(0, true)/10);
       console.log("Sunlight: ",value.getInt32(3,true));
       console.log("Moister: ", value.getUint8(7,true));
    console.log("Fertility: ", value.getUint16(8,true));
            console.log(JSON.stringify(value.buffer));
           gatt.disconnect();
           console.log("Done!");
         })
           .catch(function(error){
             console.log("error", error);
           });
        }
    
        setWatch(function() {
          getData();
        }, BTN, { repeat:true, edge:"rising", debounce:50 });
    
About

Avatar for furuskog @furuskog started