Simple BLE Example (Scan Advertising Devices, List Details, Connect to One Sensor Device)

Serial.printlnf("Humd %.1f % (raw: %d)", Humd, rawHumd);

Sincer % is used to escape variable placeholders you need to also escape the percent sign itself.
Consequently you’d need to do this

Serial.printlnf("Humd %.1f %% (raw: %d)", Humd, rawHumd);

in order to get the symbol turn up in the output.

Are you sure you want to have the humidity reading to depend on the validity of the temperature characteristics?

  else if (Temperature.valid()) { 
    loopDelay = 1000;                                                           // when connected read every second could be modulated via delta temp more volatile temperature may warrant a lower loop cadance
    
    Temperature.getValue(&rawTemp);                                             // request temperature from BLE peripheral
    temp = rawTemp / 100.0;                                                     // convert from 100ths, although too simple
    Serial.printlnf("Temp %.1f °C (raw: %d)", temp, rawTemp);
    
    Humidity.getValue(&rawHumd);
    if (sizeof(rawHumd) ==  Humidity.getValue((uint8_t*)&rawHumd, sizeof(rawHumd)))
        Humd = rawHumd / 100.0;
    
    //Humidity.getValue(&rawHumd);                                                // request temperature from BLE peripheral
    //Humd = rawHumd / 100.0;                                                     // convert from 100ths, although too simple
    Serial.printlnf("Humd %.1f %% (raw: %d)", Humd, rawHumd);
    
  }
1 Like