• Hello all,

    I am a newbie and appreciate any help. I have tried generating a solution but have lost much hair trying!

    I connect to the puck from a Windows browser using the following javascript function and query the accelerometer with a timer using the subsequent function. How can I detect if the puck.js disconnects?

    Thanks in advance,

    Jeff

    // When we click the connect button...
        function connectclick() {
          Puck.write('Puck.accelOn(1.6);\n');
          Puck.write('NRF.setTxPower(4);\n');
          acceltimer = setInterval(accelcollect,650);
        }
    
        function accelcollect() {
          Puck.eval("Puck.accel()",function(x) {
            //Get accel data
            accel.x=x.acc.x;
            accel.y=x.acc.y;
            accel.z=x.acc.z;       
          })
        }
    
About

Avatar for Jeff @Jeff started