0

As i understand the dallas library, there are two ways of referencing the sensor, one is to refer to the address, and the other is just to grab it as it is indexed.(gettempbyindex)

I want to know how to set the resolution of the sensor when i'm using the gettempbyindex method, all the examples i can find seem to only set resolution when specifying the address explicitly..

Is it even possible?

1 Answer 1

1

You can use getAddress: bool DallasTemperature::getAddress(uint8_t* deviceAddress, uint8_t index)

If you want to set the resolution for all devices, you can just use void DallasTemperature::setResolution(uint8_t newResolution). (It will call getAddress for all indices.)

2
  • Thanks for the reply, i couldn't figure out how to implement what you suggested, but your suggestion led me to what seems like a good solution to my problem. sensors.setResolution(10); seemed to do the trick, with "sensors" being whatever was initially declared to the dallas library in setup...
    – gambituk
    Sep 18, 2017 at 17:47
  • Take a look at the implementation of setResolution to see how to use getAddress.
    – tttapa
    Sep 18, 2017 at 21:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.