PaulStoffregen / OneWire

Library for Dallas/Maxim 1-Wire Chips
http://www.pjrc.com/teensy/td_libs_OneWire.html
579 stars 382 forks source link

adding option to set pin later #54

Closed tomasmmm closed 6 years ago

tomasmmm commented 6 years ago

This help to define OW without pin (initially in global scope) and define it later in setup() / loop().

This allows storing of configuration of OW PINs e.g. on SPIFFS, so setup() can first read them and properly configure PINs.

E.g.:

OneWire oneWire_1, oneWire_2;

void setup() {
    // read PIN e.g. from SPIFFS

    Serial.println("Setup 1W T1");
    oneWire_1.apin(pin.toInt());  // Set the pin

    // then use normally
}
PaulStoffregen commented 6 years ago

fixed by https://github.com/PaulStoffregen/OneWire/commit/6ad660a9435c36946530b1bc28c892bd4cc582d2