analog-read

maks971014/esp8266-ap/analog-read

No description
analog-read
@/analog-read
PORTport
Analog port to read from. Should start with `A` to succeed.
UPDpulse
Triggers new read
analog-read
VAL
DONE
PORT
UPD
DONEpulse
Fires on reading complete
VALnumber
The latest read value in range 0.0 … 1.0
To use the node in your project you should have the maks971014/esp8266-ap 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

#pragma XOD error_raise enable

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    if (!isInputDirty<input_UPD>(ctx))
        return;

    const uint8_t port = getValue<input_PORT>(ctx);

    if (!isValidAnalogPort(port)) {
        raiseError(ctx);
        return;
    }

    ::pinMode(port, INPUT);
    emitValue<output_VAL>(ctx, ::analogRead(port));
    emitValue<output_DONE>(ctx, 1);
}