433-rf-receive

wayland/433mhz-rf-module/433-rf-receive

Receive a message as a string. Pin 11 of the Arduino should be connected to the data pin of the receiver.
433-rf-receive
@/433-rf-receive
Receive a message as a string. Pin 11 of the Arduino should be connected to the data pin of the receiver.
DEV@/433-rf-device
A 433-rf-device.
UPDpulse
Update. Check if new message has been received.
433-rf-receive
DEV
UPD
MSG
REC
RECpulse
Received. Pulse on reception of message.
MSGstring
Message. The message that has been received.
To use the node in your project you should have the wayland/433mhz-rf-module 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 {
    uint8_t buf[RH_ASK_MAX_MESSAGE_LEN];
    CStringView view;
    State() : view(buf) {}
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    auto state = getState(ctx);

    // The node responds only if there is an input pulse
    if (!isInputDirty<input_UPD>(ctx))
        return;

    // Get a pointer to the `RH_ASK` class instance
    auto driver = getValue<input_DEV>(ctx);

    uint8_t buflen = sizeof(state->buf);

    // clear buffer
    memset(state->buf, 0, buflen);

    if (driver->recv(state->buf, &buflen)) // Non-blocking
    {
        emitValue<output_MSG>(ctx, XString(&state->view));
        emitValue<output_REC>(ctx, 1);
    }
}