portd-write

krishowell/mass-digital-write/portd-write

Writes the signal value to pins selected from the pin input. of PORTD registry. ex - 0011 0001 input write the SIG value to pins 2, 3, and 7.
portd-write
@/portd-write
Writes the signal value to pins selected from the pin input. of PORTD registry. ex - 0011 0001 input write the SIG value to pins 2, 3, and 7.
PINbyte
A binary number that represents each pin of the target hardware on PORTD. Setting a bit to "1" selects the pin for writing. The most significant bit is first and the least significant is last. ex- ardunio uno most significant bit is pin 0 and the least significant is pin 7
UPDpulse
SIGboolean
the value that is written to the selected pins.
portd-write
DONE
PIN
UPD
SIG
DONEpulse
Outputs a pulse when the code has finish writing to the PORTD registry
To use the node in your project you should have the krishowell/mass-digital-write 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))//This line controls how often this codes run.
        return;

    byte PIN = getValue<input_PIN>(ctx);//The PIN varible retrieves the byte input node value
    const bool SIG = getValue<input_SIG>(ctx);

    for(uint8_t i = 0; i < 8; i++, PIN = PIN << 1){
        if(PIN & B10000000){
            ::pinMode(i, OUTPUT);
            ::digitalWrite(i, SIG);
        }
    }
    emitValue<output_DONE>(ctx, 1);
}