• You need:

    NRF.setAdvertising({}, { manufacturer: 0x0590, manufacturerData: [pushbuttonCounter], interval:20});
    

    It's meant to go in the second argument, not the third - then hopefully things will work better

  • Thanks!
    got it working, as blemidi on osx is broken in term of auto reconnection I am basically making a workaround with advertisements. I am using the motion example, is there a way to advertise at interval 20 but only when the device is moving?

    here is the code:

    NRF.setTxPower(4);
    //NRF.setConnectionInterval(20);
    
    function rescaleToMidiCC(value, oldMin, oldMax) {
      var newMin = 0;
      var newMax = 127;
      var rescaled = Math.round((value - oldMin) * (newMax - newMin) / (oldMax - oldMin) + newMin);
      rescaled = Math.min(127, Math.max(0, rescaled));
      return rescaled;
    }
    
    
    require("puckjsv2-accel-movement").on();
    var idleTimeout;
    
    Puck.on('accel',function(a) {
      LED.set();
    
      if (idleTimeout) clearTimeout(idleTimeout);
      idleTimeout = setTimeout(function() {
        idleTimeout = undefined;
        LED.reset();
        //active = false ;
      },500);
      const accel = Puck.accel();
      var x = ((accel.acc.x/128000)*10) *127;
      var y = ((accel.acc.y/128000)*10) *127;
      x = rescaleToMidiCC(x, -120, 120);
      y = rescaleToMidiCC(y, -120, 120);
      print(x + " " + y);
      NRF.setAdvertising({}, { manufacturer: 0x0590, manufacturerData:           [x,y], interval:20});
    
    });
    
About

Avatar for Gordon @Gordon started