Avatar for don

don

Member since Feb 2018 • Last active Feb 2018
  • 3 conversations
  • 7 comments

Most recent activity

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

    @AntiCat the NDEF code is all JavaScript, so it should work. This npm will generate the NDEF bytes and I'll use NRF to write it, similar to the way libfreefare was used. I need to update that documentation.

    @Wilberforce thanks for the link. I'll work on getting this converted.

  • started
    • 5 comments
    • 273 views
  • in Puck.js, Pixl.js and MDBT42
    Avatar for don

    I have an npm for creating and parsing NFC NDEF messages. https://www.npmjs.com/package/ndef Unfortunately it's multiple files so I can't just require it on the Puck. What's the best way to make this npm compatible with the Puck?

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

    0xCC00 is fine, I just waited 5 minutes before taking a screenshot.

    • 5 comments
    • 497 views
  • in Puck.js, Pixl.js and MDBT42
    Avatar for don

    @Gordon I like your nRF API. It's really easy to set the Service Data. This works great.

    // Demonstrate broadcasting a characteristic value
    // Use nRF Connect to see the counter value without connecting
    
    let count = 0;
    
    NRF.setServices({
        0xEEE0 : {
          0xEEE1 : {
            value: [0, 0],
            readable: true,
            notify: true,
            broadcast: true,
            description: 'Count'
          }
        }
      }, { advertise: [ 'EEE0' ] });
    
    function notify() {
      const buffer = new Uint16Array([count]).buffer;
      NRF.updateServices({
        0xEEE0 : {
          0xEEE1 : {
            value: buffer,
            broadcast: true,
            notify: true
          }
        }
      });
      // Set the service data 0x16 to the count value
      NRF.setAdvertising({
        0xEEE0: buffer
      });
    }
    
    setInterval(() => {
      count++;
      if (count > 0xFFFF) {
        count = 0;
      }
      notify();
    }, 1000);
    
  • in Other Boards
    Avatar for don

    The polarity swap in 1v95.176 is a welcome change. Setting the pinMode worked well in 1v95.

    @Gordon thanks for fixing this so quickly

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

    I'd like to broadcast a characteristic value so it can be read from the advertising information without connecting.

    Here's an Arduino example increments a counter and broadcasts the value - BroadcastCount.ino. Using nRF Connect, I can see the characteristic value. (See attached image.)

    According to the docs, it looks NRF.setServices broadcast property might do this, but I can't get it to work on the Puck.js.

    // Demonstrate broadcasting a characteristic value
    // Use nRF Connect to see the counter value without connecting
    
    let count = 0;
    
    NRF.setServices({
        0xEEE0 : {
          0xEEE1 : {
            value: count,
            readable: true,
            notify: true,
            broadcast: true,
            description: 'Count'
          }
        }
      }, { advertise: [ 'EEE0' ] });
    
    function notify() {
      NRF.updateServices({
        0xEEE0 : {
          0xEEE1 : {
            value: count,
            broadcast: true,
            notify: true
          }
        }
      });
    }
    
    setInterval(function() {
      count++;
      notify();
    }, 1000);
    

    Should broadcast update the service info or do I need to manually build this into the advertising data?

  • in Other Boards
    Avatar for don

    With v1.95 on the BBC micro:bit the button watch only fires 1 time.

    setWatch(function(e) {
      if (e.state) console.log("Released");
      else console.log("Pressed");
    }, BTN1, {repeat:true, debounce:20, edge:"both"});
    

    Reverting back to v1.94 this works as expected on the micro:bit.

    This code work OK on Puck.js with v1.95

Actions