• This Pixl program advertises a service, treats "onWrite" queries, and write the received character in a loop, every second:

    var eventData = "NOTHING";
    
    NRF.setServices({
      0xEDCB : {
        0xBA98 : {
          description: "MyCharact",
          writable  : true,
          onWrite : function(evt) {
            eventData = evt.data;
          }
        }
      }
    },
    { advertise: [ 'EDCB' ]});
    
    var counter = 0;
    
    function intervalHandler()
    {
      console.log("counter: " + counter + " Data=" + eventData);
      counter++;
    }
    
    setInterval(intervalHandler, 1000);
    
    g.clear();
    g.flip();
    LED.set();
    
    NRF.on('connect', function(addr) {
      console.log("Connection. addr=", addr);
    });
    
    NRF.on('disconnect', function(reason) {
      console.log("reason=" + reason);
    });
    

    Apparently, it can receive only one character. When sending byte arrays of more than one byte with nRF Connect or BLEScanner, nothing happens. However, when sending one byte only, it is received and correctly displayed.

    What do you think, please ?

About

Avatar for rchateauneu @rchateauneu started