-
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; }) }
-
-
Hi Gordon,
Thanks for the help. I bought it from Espruino.com with Order ID: 4596 on 10 June. The Puck.js says 2.1a and a picture is below. Curiously when I first flashed the Puck.accelOn(), Espruino Web IDE gave appropriate values for accel and gyro. Now Puck.accelOn() gives Uncaught error: Not available on Puck.js v1 as shown in the screenshot below.
Thanks in advance,
Jeff
-
Thanks for the information Robin. I will look into a try/catch block.
Rather than looking for an error is could I query the BLE and make use of the following information the puck sends?
Sorry if this is total newby question.
puck.js:406 Connected
puck.js:406 SEND ERROR: NotSupportedError: GATT operation failed for unknown reason.
puck.js:406 Disconnected (gattserverdisconnected)