• NRF.setScanRespose doesn't return anything, so what you're doing is effectively:

                NRF.getAdvertisingData({},{manufacturer:­ 0x0590, manufacturerData:data}),
       ], {interval:1000});

    Which is just:

    NRF.setAdvertising({},{manufacturer: 0x0590, manufacturerData:data,interval:1000});

    Actually I made the same mistake with the example code - using advertise instead of get. It should be:

    var bUrl = "stackoverflow.com"; // Updated from Node-Red
      function updateAdv() {
        var data = [JSON.stringify(Puck.light().toFixed(3) * 1000), Math.round(E.getTemperature())];
            NRF.getAdvertisingData({},{manufacturer:­ 0x0590, manufacturerData:data}),
            ], {interval:100});
      setInterval(updateAdv, 5000); 

    I just tried this and it works for me. Your inability to connect is most likely because the interval was 1000ms - BLE broadcasts on 3 frequencies in turn, and it's also alternating advertising packets so a computer trying to connect is only seeing an advertising packet every 6 seconds - pretty much any connecting computer will time out connecting unless you're very lucky.

    Hope that helps!

    Just to add [JSON.stringify(Puck.light().toFixed(3) * 1000), Math.round(E.getTemperature())] is probably not what you want... It's creating a String of ascii characters with quotes around it, which is then being converted to a series of bytes (which could be variable length).

    It's probably best to just pack it into a byte with: [Puck.light()*255, Math.round(E.getTemperature())] (the conversion to integer gets done automatically).


Avatar for Gordon @Gordon started