write(digital-ports)

koadrobot/ports/write(digital-ports)

No description
write(digital-ports)
@/write(digital-ports)
P0boolean
P1boolean
P2boolean
P4boolean
P7boolean
P8boolean
P12boolean
P13boolean
SIGboolean
State
PULLboolean
Hardware connection. pulldown (true) - High, pullup (false) - Low (1-duty).
UPDpulse
Triggers new write
write(digital-ports)
P0
P1
P2
P4
P7
P8
P12
P13
SIG
PULL
UPD
DONE
DONEpulse
Fires on writing complete
To use the node in your project you should have the koadrobot/ports 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

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx)
{
    if (isInputDirty<input_UPD>(ctx))
    {
         bool val = getValue<input_SIG>(ctx);

         if (!getValue<input_PULL>(ctx)) val = !val;

        if (getValue<input_P0>(ctx)) { ::pinMode(0, OUTPUT);  ::digitalWrite(0, val); }
        if (getValue<input_P1>(ctx)) { ::pinMode(1, OUTPUT);  ::digitalWrite(1, val); }
        if (getValue<input_P2>(ctx)) { ::pinMode(2, OUTPUT);  ::digitalWrite(2, val); }
        if (getValue<input_P4>(ctx)) { ::pinMode(4, OUTPUT);  ::digitalWrite(4, val); }
        if (getValue<input_P7>(ctx)) { ::pinMode(7, OUTPUT);  ::digitalWrite(7, val); }
        if (getValue<input_P8>(ctx)) { ::pinMode(8, OUTPUT);  ::digitalWrite(8, val); }
        if (getValue<input_P12>(ctx)){ ::pinMode(12,OUTPUT);  ::digitalWrite(12,val); }
        if (getValue<input_P13>(ctx)){ ::pinMode(13,OUTPUT);  ::digitalWrite(13,val); }

        emitValue<output_DONE>(ctx, 1);
    }
}