Testing puck.js from windows and Android ?

Posted on
  • Thanks to Gordon, I now have a puck for testing.
    It took some time to figure out, how to connect WebIDE from windows 10 puck.
    Chrome or webpage did not work, but installation of local WebIDE application made it

    At the end this is my way today:

    1. open settings for Bluetooth
    2. click add bluetooth device
    3. wait for my puck to appear and the click
    4. wait for ready, and close window
    5. puck should now appear in bluetooth devices
    6. now start local WebIDE (nw.exe)
    7. click connect
    8. select puck in list and it should work now.

    After switching off power from puck, all steps need to be done again.

    Next step was to setup puck as server

    function set(nr){
      var ble;
      switch(nr){
        case 1:
          ble = {0xBCDE : { 0xABCD : { value : "Hello", readable : true } },
                 0xCDEF : { 0xBCDE : { value : "Hallo", readable : true },
                            0x1234 : { value : "Egon", readable : true  } } }; break;
        case 2:
          ble = {0xBCDE : { 0xABCD :{ value : "hello", readable : true } } }; break;
      }
      NRF.setServices(ble,{});
      NRF.setAdvertising({}, {name: "MyPuck",showName: true,discoverable: true});
    }
    

    After starting this, I switched to my mobile phone and started nRF connect, but puck was not found.
    Puck appeared on my mobile only after disconnecting puck from WebIDE.
    Is there a way to have puck connected to WebIDE and see it in my mobile ?
    Otherwise testing would be difficult.

  • Yes - using the relay ide - I don't have the link handy -

  • Info on the relay here: http://forum.espruino.com/conversations/­300770/

    You may struggle running nRF connect and the relay at the same tine though.

    After starting this, I switched to my mobile phone and started nRF connect, but puck was not found.
    Puck appeared on my mobile only after disconnecting puck from WebIDE.

    This is just the way it works. Devices can only have one connection at a time. They advertise when they are not connected to another device. When they are connected, advertising stops.

    However, you can still connect via serial: http://www.espruino.com/Puck.js#serial-c­onsole

    If you do that you can use the standard IDE that you use for USB devices, and you have none of the messing around with connections.

  • This is just the way it works. Devices can only have one connection at a time. They advertise when they are not connected to another device. When they are connected, advertising stops.

    Not having immersed myself much into Bluetooth/BLE, this question popped-up for me:

    Can a device scan between (individual) advertisements? I know that the purpose of advertising is to say I can be connected to... and that would be not possible while a device is scanning and I know that scanning is a comparably time-consuming / lengthy / power-consuming.

  • Can a device scan between (individual) advertisements?

    Yes, I believe so. However it'll obviously miss some advertisements if they come at the same time as it is transmitting.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Testing puck.js from windows and Android ?

Posted by Avatar for JumJum @JumJum

Actions