x27-589-device

wayland/x27-589-gauge/x27-589-device

Create an X27-589 device.
x27-589-device
@/x27-589-device
Create an X27-589 device.
PIN1port
1st digital output pin.
PIN2port
2nd digitial output pin.
PIN3port
3rd digital output pin.
PIN4port
4th digital output pin.
x27-589-device
PIN1
PIN2
PIN3
PIN4
DEV
DEV@/x27-589-device
An X27-589 device.
To use the node in your project you should have the wayland/x27-589-gauge 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/clearwater/SwitecX25"

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

node {

    meta {
        using Type = SwitecX25*;
    }

    static_assert(isValidDigitalPort(constant_input_PIN1), "must be a valid digital port");
    static_assert(isValidDigitalPort(constant_input_PIN2), "must be a valid digital port");
    static_assert(isValidDigitalPort(constant_input_PIN3), "must be a valid digital port");
    static_assert(isValidDigitalPort(constant_input_PIN4), "must be a valid digital port");

    // Number of steps = 315*3 = 945
    const uint16_t STEPS = 945;
    SwitecX25 gauge = SwitecX25(STEPS, constant_input_PIN1, constant_input_PIN2, constant_input_PIN3, constant_input_PIN4);

    void evaluate(Context ctx) {
        // It should be evaluated only once on the first (setup) transaction
        if (!isSettingUp())
            return;

        emitValue<output_DEV>(ctx, &gauge);
    }
}