Avatar for primalanomaly


Member since Dec 2017 • Last active Dec 2017
  • 2 conversations

Most recent activity

  • in Puck.js, Pixl.js and MDBT42
    Avatar for primalanomaly

    Thanks, that seems to do the job!
    Might be worth noting, though, that it doesn't appear to work every time - sometimes the connection can drop out, and no close event is fired. When this happens, the "Disconnected (gattserverdisconnected)" log does not appear in the console from puck.js either.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for primalanomaly

    If a puck disconnects from my browser due to the connection dropping out (e.g. it moves out of range) is there a way to detect this on the web front end? I can see that puck.js creates the following console log:
    Disconnected (gattserverdisconnected)

    I’m using the following code snippet to create a 2-way connection as per one of your site tutorials. This includes the part about resetting the puck on disconnection, which seems to work fine on the puck - I just want to be able to reset the browser too.

    Puck.connect(function(connection) { 
        connection.on("data", function(d) { 
            // handle receiving data 
        connection.write("reset();\n", function() { 
                // do various stuff here 
                // reset on disconnect 
                connection.write("NRF.on('disconnect',fu­nction(){ reset(); });\n",function(){}); 
        // I'm hoping there's a way to detect disconnection here 
        // e.g. connection.on("disconnect", function(){}); 


  • in Puck.js, Pixl.js and MDBT42
    Avatar for primalanomaly

    Never mind - looks like I needed a firmware update! All good now :)

  • in Puck.js, Pixl.js and MDBT42
    Avatar for primalanomaly

    Thank both, that's very helpful! I have got the first 2 working, but I think I'm using NRF.getAddress() wrong, as I'm getting the following error: "Uncaught Error: Function "getAddress" not found!"

    My code is as follows:

    Bluetooth.println('BOARD:'+process.env.B­OARD); // works
    Bluetooth.println('SERIAL:'+getSerial())­; // works
    Bluetooth.println('MAC:'+NRF.getAddress(­)); // does not work

    Am I doing anything obviously wrong? Does NRF need to be used differently?

  • in Puck.js, Pixl.js and MDBT42
    Avatar for primalanomaly

    Hello, I've just been playing with a Puck.js for the first time, and I must say, it's quite incredible!

    I was just wondering if there's a way to retrieve the device name and ID once it's connected in the browser, as js vars. I see that these appear as console logs, upon connection, but I can't find a way to access them. Is there a general "get device info" function or something?

    I've been successfully working with button clicks, LEDs, light, temperature and magnet sensing, but am failing to find any documentation for this, although it seems like something that'd be essential for dynamically working with multiple devices. Thank you!