How to change the resolution of DS18B20? I'm using DS18B20 sensor with this library, the 750ms delay is causing problem in timer part of my code. the code below is from DallasTemperature.cpp:

// returns number of milliseconds to wait till conversion is complete (based on IC datasheet)
int16_t DallasTemperature::millisToWaitForConversion(uint8_t bitResolution) {

    switch (bitResolution) {
    case 9:
        return 94;
    case 10:
        return 188;
    case 11:
        return 375;
    default:
        return 750;
    }


I'm reading the temperature like this:

#include &lt;OneWire.h&gt;
#include &lt;DallasTemperature.h&gt;
#define ONE_WIRE_BUS A0
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&amp;oneWire);

void setup() {}

void loop () {
    float currentTemp = sensors.getTempCByIndex(0);
    sensors.requestTemperatures();
}


sensor is not connected in parasite mode, and there is only one sensor.

How can i change the resolution from 12 to 9 bit?
Simple:

sensors.setResolution(9);


It normally defaults to 9, but then probes the connected device to find the maximum resolution it supports and sets it to that. This would normally be done in sensors.begin() which you omitted from your snippet above. If you don't have that it will be on 9 bit anyway, and also the bus probably won't work regardless.