letter-to-step-4

gabbapeople/iot-split-flap-display/letter-to-step-4

Transforms input character byte into the number of steps for the fourth digit.
letter-to-step-4
@/letter-to-step-4
Transforms input character byte into the number of steps for the fourth digit.
Lbyte
letter-to-step-4
STEP
L
STEPnumber
To use the node in your project you should have the gabbapeople/iot-split-flap-display 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 {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    int steps = 0;
    int letter = getValue<input_L>(ctx);
    switch (letter){
        case 0x41: steps = 0; break;   //A
        case 0x42: steps = 1; break;  //B
        case 0x43: steps = 2; break;  //C
        case 0x44: steps = 3; break;  //D
        case 0x45: steps = 4; break;  //E
        case 0x46: steps = 5; break;  //F
        case 0x47: steps = 6; break;  //G
        case 0x48: steps = 7; break;  //H
        case 0x49: steps = 8; break;  //I
        case 0x4A: steps = 9; break;  //J
        case 0x4B: steps = 10; break; //K
        case 0x4C: steps = 11; break; //L
        case 0x4D: steps = 12; break; //M
        case 0x4E: steps = 13; break; //N
        case 0x4F: steps = 14; break; //0 O
        case 0x50: steps = 15; break; //P
        case 0x51: steps = 16; break; //Q
        case 0x52: steps = 17; break; //R
        case 0x53: steps = 18; break; //S
        case 0x54: steps = 19; break; //T
        case 0x55: steps = 20; break; //U
        case 0x56: steps = 21; break; //V
        case 0x57: steps = 22; break; //W
        case 0x58: steps = 23; break; //X
        case 0x59: steps = 24; break; //Y
        case 0x5A: steps = 25; break; //Z
        case 0x31: steps = 26; break; //1
        case 0x32: steps = 27; break; //2
        case 0x33: steps = 28; break; //3
        case 0x34: steps = 29; break; //4
        case 0x35: steps = 30; break; //5
        case 0x36: steps = 31; break; //6
        case 0x37: steps = 32; break; //7
        case 0x38: steps = 33; break; //8
        case 0x39: steps = 34; break; //9
        case 0x20: steps = 35; break; //_
        default: break;
    }
       emitValue<output_STEP>(ctx, steps);
}