digital-write

xod/gpio/digital-write

Outputs high or low signal on a board port. Possible errors: — Invalid port
digital-write
@/digital-write
Outputs high or low signal on a board port. Possible errors: — Invalid port
PORTport
Board port to write to
SIGboolean
State to write
UPDpulse
Triggers new write
digital-write
PORT
SIG
UPD
DONE
DONEpulse
Fires on writing complete

Previously known as xod/core/digital-output.

C++ implementation

#pragma XOD evaluate_on_pin disable
#pragma XOD evaluate_on_pin enable input_UPD

node {
    void evaluate(Context ctx) {
        static_assert(isValidDigitalPort(constant_input_PORT), "must be a valid digital port");

        if (!isInputDirty<input_UPD>(ctx))
            return;

        ::pinMode(constant_input_PORT, OUTPUT);
        const bool val = getValue<input_SIG>(ctx);
        ::digitalWrite(constant_input_PORT, val);
        emitValue<output_DONE>(ctx, 1);
    }
}