Skip to content

ScanForDevices()

Arnd edited this page Dec 3, 2016 · 1 revision

ScanForDevices();

This function will perform the standard MAXIM search algorithm (see 1-Wire Search Algorithm for details) and return the number of DS-Family devices detected. The unique 8-Byte identifiers for each device are written to EEPROM and addressing the devices henceforth is done via the device index, 0 to [devicesFound-1]. The order in which the devices are detected is deterministic and the methods used to write to EEPROM only update the memory when things have changed; this reduces the number of EEPROM modifications and extends the life of the chip.


Example:

const uint8_t ONE_WIRE_PIN = 8;             // 1-Wire microLAN pin
DSFamily_Class ds(ONE_WIRE_PIN);            // Instantiate
uint8_t thermometers = ds.ScanForDevices(); // find all devices
Serial.print("Found ");
Serial.println(thermometers);