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
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.)
-
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– gambituk2017年09月18日 17:47:22 +00:00Commented Sep 18, 2017 at 17:47
-
Take a look at the implementation of setResolution to see how to use getAddress.tttapa– tttapa2017年09月18日 21:53:01 +00:00Commented Sep 18, 2017 at 21:53