• I have tried broadcasting ('advertising') using example code from this thread and it works great.

    setInterval(function() {
      NRF.setAdvertising({
        0x1809 : [Math.round(E.getTemperature())]
      });
    }, 1000);
    

    on the monitoring end the EspruinoHub software works well on the RPi. The temperature in this case gets published by the hub to the local mosquitto MQTT broker where it can be subscribed to by any MQTT client. For example the client on the RPi (change the MAC address to yours)

    mosquitto_sub -v -t /ble/advertise/c7:6e:71:dd:ee:ff/temp
    

    or

    mosquitto_sub -v -t /ble/advertise/# | grep temp
    

    Note that the hub only publishes when the temp value has changed, or every 60 seconds.

    This is what the EspruinoHub displays while it is running in the foreground and while the Puck is advertising the temperature

    Config loaded
    MQTT Connected
    <HTTPProxy> Bleno State poweredOn
    <HTTPProxy> Bleno.startAdvertising Success
    <HTTPProxy> Bleno.setServices Success
    Scanning started...
    
    Thu Dec 22 2016 09:30:53 GMT-0500 (EST)
    
    eb:83:4c:dd:ee:ff - Puck.js eeff (RSSI -63)
      1809 => {"temp":19}
    
    
About

Avatar for dklinkman @dklinkman started