multiple ds2438Z on bus

Hello,

I am trying to use this code to talk to multiple sensors.

Has anyone changed this code for multiple devices?

Thanks,

The ds2438 temperature and voltage example has this code at the beginning:

// define the 1-Wire address of the DS2438 battery monitor here (lsb first)
uint8_t DS2438_address[] = { 0x26, 0x45, 0xe6, 0xf7, 0x00, 0x00, 0x00, 0x4e };

OneWire ow(ONE_WIRE_PIN);
DS2438 ds2438(&ow, DS2438_address);

void setup() {
    Serial.begin(9600);
    ds2438.begin();
}

To make it handle a small number of additional sensors you could change it to this:

// define the 1-Wire address of the DS2438 battery monitor here (lsb first)
uint8_t DS2438_address_1[] = { 0x26, 0x45, 0xe6, 0xf7, 0x00, 0x00, 0x00, 0x4e };
uint8_t DS2438_address_2[] = { 0x26, 0x45, 0xe6, 0xf7, 0x00, 0x00, 0x00, 0x4e };
uint8_t DS2438_address_3[] = { 0x26, 0x45, 0xe6, 0xf7, 0x00, 0x00, 0x00, 0x4e };

OneWire ow(ONE_WIRE_PIN);
DS2438 ds2438_1(&ow, DS2438_address_1);
DS2438 ds2438_2(&ow, DS2438_address_2);
DS2438 ds2438_3(&ow, DS2438_address_3);
void setup() {
    Serial.begin(9600);
    ds2438_1.begin();
    ds2438_2.begin();
    ds2438_3.begin();
}

You then must do a similar modification of the code in the loop() function so that it handles ds2438_1, ds2438_2 and ds2438_3 instead of just ds2438.
If you are going to add a lot more than this, you'd be better off using an array of addresses and an array of the DS2438 objects.

Pete