• function reading(timeout) {
    NRF.requestDevice({ timeout: timeout,filters: [{ "services": [
         'a495ff10-c5b1-4b44-b512-1370f02d74de'
         ]}] }).then(function(device) {
       console.log(device);
      d = new DataView(device.data);
      dF=d.getUint16(22);
    readings= { temp: (( dF -32) * 5 / 9).toFixed(1), F:dF,gravity:(d.getUint16(24)/1000.0).to­Fixed(3), d:device.data  };
    console.log(readings);
      return 1;
     }).then(function() {
      console.log("Done!");
    });
    };
    
    reading(5000);
    
    =undefined
    BluetoothDevice: {
      "id": "04:a3:16:9a:af:cc public",
      "rssi": -89,
      "data": new Uint8Array([26, 255, 76, 0, 2, 21, 164, 149, 187, 16, 197, 177, 75, 68, 181, 18, 19, 112, 240, 45, 116, 222, 0, 62, 3, 238, 197]).buffer,
      "manufacturer": 76,
      "manufacturerData": new Uint8Array([2, 21, 164, 149, 187, 16, 197, 177, 75, 68, 181, 18, 19, 112, 240, 45, 116, 222, 0, 62, 3, 238, 197]).buffer,
      "services": [
        "a495ff10-c5b1-4b44-b512-1370f02d74de"
       ]
     }
    {
      "temp": "16.7",
      "F": 62,
      "gravity": "1.006",
      "d": new Uint8Array([26, 255, 76, 0, 2, 21, 164, 149, 187, 16, 197, 177, 75, 68, 181, 18, 19, 112, 240, 45, 116, 222, 0, 62, 3, 238, 197]).buffer
     }
    Done!
    

    And this is from the app:


    1 Attachment

    • tilt.PNG
About

Avatar for Wilberforce @Wilberforce started