rich-buzzer

cesars/rich-uno-r3/rich-buzzer

Node uses port D9
rich-buzzer
@/rich-buzzer
Node uses port D9
BUZZERport
Tnumber
🔊pulse
Pulse buzzer
rich-buzzer
BUZZER
T
🔊
DONE
DONEpulse
Pulse done
To use the node in your project you should have the cesars/rich-uno-r3 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 evaluate_on_pin enable input_UD83DUDD0A

node {

    static_assert(isValidDigitalPort(constant_input_BUZZER), "must be a valid digital port");

    void evaluate(Context ctx) {
        ::pinMode(constant_input_BUZZER, OUTPUT);
        if (isInputDirty<input_UD83DUDD0A>(ctx)) {
            TimeMs dt = getValue<input_T>(ctx) * 1000;
            setTimeout(ctx, dt);
            ::digitalWrite(constant_input_BUZZER, 1);
        } else if (isTimedOut(ctx)) {
            emitValue<output_DONE>(ctx, 1);
            ::digitalWrite(constant_input_BUZZER, 0);
        }
    }
}