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?

asked Sep 15, 2017 at 22:00

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.)

FarO
3391 gold badge4 silver badges16 bronze badges
answered Sep 16, 2017 at 1:00
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... Commented Sep 18, 2017 at 17:47
  • Take a look at the implementation of setResolution to see how to use getAddress. Commented Sep 18, 2017 at 21:53

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.