digital-read-pullup

diego-werneck/digital-read-pullup/digital-read-pullup

No description
digital-read-pullup
@/digital-read-pullup
PORTport
Board port to read from
UPDpulse
Triggers new read
PULLUPboolean
True enables PullUp False disable PullUp
digital-read-pullup
SIG
DONE
ERR
PORT
UPD
PULLUP
ERRpulse
Fires if update failed. E.g. `PORT` does not exist.
DONEpulse
Fires on reading complete
SIGboolean
The last read signal value
To use the node in your project you should have the diego-werneck/digital-read-pullup 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))
        return;

    const uint8_t port = getValue<input_PORT>(ctx);
    if (!isValidDigitalPort(port)) {
        emitValue<output_ERR>(ctx, 1);
        return;
    }

    ::pinMode(port, INPUT);
    ::digitalWrite(port, getValue<input_PULLUP>(ctx));
    emitValue<output_SIG>(ctx, ::digitalRead(port));
    emitValue<output_DONE>(ctx, 1);
}