• I'm not sure I understand the problem - you should just get a byte array from Android, and element 0 will be temperature, 1 will be light, etc. If you can read out the first byte to see what the data is, and the second byte to read the data itself then you're basically all the way to decoding everything.

    You can always do:

    function getMyData() {
      return [
        0,E.getTemperature(),
        1,Puck.light()*256, 
        2,Puck.getBatteryPercentage(),
        3,myState];
    }
    

    But if you want to send multiple different characteristics that you can read separately then that's what having multiple different characteristics is for...

    NRF.setServices({
      0x1234 : {
        0x5678 : {  value :  [E.getTemperature()],  readable : true  },
        0x5679 : {  value :  [Puck.light()*256],  readable : true  },
        0x567A : {  value :  [Puck.getBatteryPercentage()],  readable : true  },
        0x567B : {  value :  [myState],  readable : true  },
      }
    });
    
About

Avatar for Gordon @Gordon started