nextion-read-wait

mendrig/nextion-lib/nextion-read-wait

No description
nextion-read-wait
@/nextion-read-wait
DUMPpulse
nextion-read-wait
DONE
CHECK
DATA
DUMP
DATAboolean
true if data avaliable
CHECKnumber
Data @ Serial2 ? 1 = Yes 0 = No 255 = Error
DONEpulse
Pulses once ...is over
To use the node in your project you should have the mendrig/nextion-lib 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 
{
    bool begun;
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    //auto inValue = getValue<input_IN>(ctx);
    
    
    
    if (!isInputDirty<input_DUMP>(ctx))
        return;
  
    State* state = getState(ctx);
    if (!state->begun) 
    {
        Serial2.begin(9600);
        state->begun = true;
    }
    
    Number Check = 255;
    
    if (Serial2.available())  
    {
        Check = 1;
        emitValue<output_DATA>(ctx, true);
    }
    else
    {
        Check = 0;
         emitValue<output_DATA>(ctx, false);
    }    

    //emitValue<output_OUT>(ctx, inValue);
    emitValue<output_CHECK>(ctx, Check);
    emitValue<output_DONE>(ctx, true);

}