Arduino 1-Wire Device Libraries

Library Format

The libraries are written in C++ and follow the conventions for Arduino compatible libraries. Unzip the needed library into your Arduino installation's library directory and include the .h file(s) in your sketch. See the example files for complete usage.

To maintain consistency, each of these libraries is used in a similar way. Declare the device at the top of the sketch and call its begin() method in the setup portion of the sketch. In the loop portion of the sketch call the device's update() method to acquire new values from the Dallas-Maxim device. Call the device's isError() method to check for failures. And call its various get() methods to read values from the device.

Some devices have init parameters to the begin() method to determine how it is to be configured, while others do not. Each device has its own set of get() methods depending on what types of values it is designed to retrieve (e.g. voltage, temperature, etc.).

Each follows this format within an Arduino sketch

// include the required header files
#include <OneWire.h>
#include <DSxxxxx.h> // substitute the needed device header file here


// declare the OneWire interface (multiple devices can be declared
// on multiple I/O pins) and DSxxxxxx device(s)
OneWire ow(ONE_WIRE_PIN);
DSXXXXX dsxxxxx(&ow, DSxxxxx_address);


void setup() {


    // initialize device

void loop() {
    if (dsxxxxx.isError()) {
        // take some error action
    } else {
        // do something with results
    // rest of code


<<Previous Page | Index | Next Page>>