portb-write

krishowell/port-read-write/portb-write

Writes the signal value to pins selected from the pin input. of PORTB registry. ex - 0011 0001 input write the SIG value to pins 8, 12, and 13.
portb-write
@/portb-write
Writes the signal value to pins selected from the pin input. of PORTB registry. ex - 0011 0001 input write the SIG value to pins 8, 12, and 13.
PINbyte
A binary number that represents each pin of the target hardware on PORTB. 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 15 and the least significant is pin 8
UPDpulse
Signals when the code should run.
SIGboolean
the value that is written to the selected pins.
portb-write
DONE
PIN
UPD
SIG
DONEpulse
Outputs a pulse when the code has finish writing to the PORTB registry
To use the node in your project you should have the krishowell/port-read-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 = 8; i < 16; i++, PIN = PIN >> 1){
        if(PIN & B00000001){
            ::pinMode(i, OUTPUT);
            ::digitalWrite(i, SIG);
        }
    }
    emitValue<output_DONE>(ctx, 1);
}