ir-send

dinosalvioni/irremote/ir-send

No description
ir-send
@/ir-send
CODEnumber
Typenumber
tipo codifica
Bitsnumber
Repeatnumber
ripetizione impulsi
Delaynumber
in ms
UPDpulse
ir-send
CODE
Type
Bits
Repeat
Delay
UPD
DONE
ACT
ACTboolean
Is flip sequence active
DONEpulse
To use the node in your project you should have the dinosalvioni/irremote 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 require "https://github.com/z3t0/Arduino-IRremote"


{{#global}}
#include <IRremote.h>
{{/global}}


struct State {
    IRsend* irsend;
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    State* state = getState(ctx);
    auto irsend = state->irsend;
    
    auto type = getValue<input_Type>(ctx);
    auto value = getValue<input_CODE>(ctx);
    auto bits = getValue<input_Bits>(ctx);
    
    if (isInputDirty<input_UPD>(ctx)) {
    emitValue<output_ACT>(ctx, true);

    for (int i = 0; i < getValue<input_Repeat>(ctx); i++) {
		
        if (type == NEC) {
             irsend->sendNEC(value, bits);
         } 
         else if (type == SONY) {
              irsend->sendSony(value, bits);
         } 
         else if (type == RC5) {
             irsend->sendRC5(value, bits);
         } 
         else if (type == RC6) {
             irsend->sendRC6(value, bits);
         }
        else {
             //Error
             //Serial.print(label);
             //Serial.println("Bad type!");
         }
        delay(getValue<input_Delay>(ctx));
    }
    emitValue<output_ACT>(ctx, false);    
    emitValue<output_DONE>(ctx, 1); 
    
    }
}