You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Sure - with Web Bluetooth it's just a matter of calling the requestDevice function again, however with the Puck.js helper you have to use it in a slightly different way:­

    If you do:

    Puck.connect(function(connection) {
        if (!connection) throw "Error!";
        connection.on('data', function(d) { ... });
        connection.on('close', function() { ... });
        connection.write("1+2\n", function() {

    You'll get a 'connection' object (no need to call close on it) - you can then just do that again, and again, to connect to more devices. I think the max allowed might be 6.

    I don't think you can do that all from one function call - so what I did for the demo was I had a 'connect' button on the webpage. Click it once and it connects to a puck and adds it to an array, click it again and then you have 2 pucks in the array, and so on.

    I'll make a note to do a proper tutorial on it :)


Avatar for Gordon @Gordon started