Page 1 of 1

orders ds18b20 probe

Posted: Wed Aug 01, 2018 11:24 am
by wipity
Hi,
could someone, if possible, let me understand how micropython orders the probes when there are more than one?
with the scan() I can see the address of the probes and I can print the single probe read with a sort of list, but if I reboot the esp8266 or if I change one probe, for example the probe[2] still remain the probe[2] or can change position? I must read the address and assign the address to example 'probe2 = probe[2]' ? I hope I'm clear...:)

OneWire scan() list ordering

Posted: Thu Aug 02, 2018 7:59 am
by pythoncoder
I hope I'm understanding this query: my reading is that it's about the order of the list returned by the OneWire scan() command.

I have little knowledge of OneWire but I'd work on the assumption that the list order is arbitrary, especially if devices are changed. It's up to you to determine the correspondence between the 64 bit device ID and its physical location: you might use a dictionary indexed by location. If you change a temperature probe at a given location you'd then need to update that dict entry.