one-wire-bus

wayland/ds18b20/one-wire-bus

Create a one-wire bus.
one-wire-bus
@/one-wire-bus
Create a one-wire bus.
PORTport
Board port number.
one-wire-bus
OWB
PORT
OWB@/one-wire-bus
One-wire bus.
To use the node in your project you should have the wayland/ds18b20 library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

// Tell XOD where it could download the library:
#pragma XOD require "https://github.com/PaulStoffregen/OneWire"

//Include C++ libraries
#include <OneWire.h>

// Define our custom type as a pointer on the class instance.
using Type = OneWire*;

node {

    meta {
        using Type = OneWire*;
    }

    static_assert(isValidDigitalPort(constant_input_PORT), "must be a valid digital port");

    OneWire ow = OneWire(constant_input_PORT);

    void evaluate(Context ctx) {
        if (!isSettingUp()) return;

        emitValue<output_OWB>(ctx, &ow);
    }
}