• Thank you all for the help! I tried uploading the example code to the puck, but when I connect to it from the react native app and printing out all characteristics, I can't seem to find the one I supposedly created using NRF.setServices().
    Am I doing something completely wrong that you can see? When using the same RN library reading from a MDBT42Q it works well.

    Espruino Code:

    console.log(NRF.getAddress());
    console.log(NRF.getBattery());
    
    NRF.setServices({
      0xBCDE : {
        0xABCD : {
          value: 'hi',
          writable : true,   // optional, default is false
          notify : true,   // optional, default is false
          indicate : true,   // optional, default is false
          description: "My Characteristic",  // optional, default is null,
          onWrite : function(evt) {
            console.log(evt.data);
          }
        }
      }
    });
    

    RN code:

    componentDidMount() {
            const bleManager = new BleManager();
    
            bleManager.startDeviceScan(null, null, async (err, device) => {
                if (err) console.log(err)
                else {
                    if (device.localName === DEVICE_NAME) {
                        bleManager.stopDeviceScan()
    
                        const deviceId = device.id;
                        console.log(`Trying to connect to device with MAC: ${deviceId}`);
    
                        try {
                            const device = await bleManager.connectToDevice(deviceId).then(d => d.discoverAllServicesAndCharacteristics());
                            const svcs = await device.services();
                            console.log('try')
                            for (let ii = 0; ii < svcs.length; ++ii) {
                                const currentService = svcs[ii];
                                let characteristics = await currentService.characteristics();
                                for (let jj = 0; jj < characteristics.length; ++jj) {
                                    const currentCharacteristic = characteristics[jj];
                                    console.table(currentCharacteristic);
                                    if (currentCharacteristic.uuid === CHARACTERISTIC_UUID {
    
    
                                  
                                        console.table(currentCharacteristic);
                                        const cc = await currentCharacteristic.writeWithoutResponse(
                                            btoa('1111111')
                                        )
                                        
                                        console.table(currentCharacteristic);
    
                                    }
    
    
                                }
                            }
                        }
                        catch (e) {
                            console.log(e)
                        }
                    }
                }
            })
        }
    
    
    
About

Avatar for user109470 @user109470 started