You are reading a single comment by @ThomasVikström and its replies. Click here to read the full conversation.
  • Ok, success! Not that I know why it did not work in the first place, but by getting rid of the cccd-handle altogether, I'm now able to receive data from 6 sensors to Bangle + calculating altitude from the barometer.

    31.54c co2:554 IAQ:56 Hum:25 1001.64 pa Gas:34170 Alt:-0.17m

    For the benefit of others, here's what I did:

    On Bangle side:
    Nothing, i.e. no need to handle_cccd = ...,

    On Arduino side:

    Changed to:

    BLEShortCharacteristic temperatureCharacteristic(BLE_SENSE_UUID­("2001"), BLERead | BLENotify);
    
    

    from:

    BLEShortCharacteristic temperatureCharacteristic(BLE_SENSE_UUID­("2001"), BLERead);
    
    

    ...and put this in the loop function:

    void loop(){
      while (BLE.connected()){
    
        static auto printTime = millis();
    
        BHY2.update();
        nicla::leds.setColor(blue);
    
        if (millis() - printTime >= 1000) {
    
          printTime = millis();
    
          float temperatureValue = temperature.value();
          temperatureCharacteristic.writeValue(tem­peratureValue * 100);
          Serial.println(temperatureValue);
    
          uint32_t co2 = bsec.co2_eq();
          co2Characteristic.writeValue(co2);
    
          float airQuality = float(bsec.iaq());
          bsecCharacteristic.writeValue(airQuality­);
    
          float pressureValue = pressure.value();
          pressureCharacteristic.writeValue((press­ureValue - 800) * 100);
          Serial.println(pressureValue);
    
          float humidityValue = humidity.value();
          humidityCharacteristic.writeValue(humidi­tyValue);
          
          unsigned int g = gas.value();
          gasCharacteristic.writeValue(g);
        }
    
    
About