multiposition

ivanmason/accelstepper/multiposition

Position array to be used by multistepper
multiposition
@/multiposition
Position array to be used by multistepper
NUMnumber
Number of stepper max of 10
multiposition
NUM
MPOSI
MPOSI@/multiposition
To use the node in your project you should have the ivanmason/accelstepper 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 {
    long* position;
    uint8_t numstepper;
    uint8_t idx;
};

struct Type {
    long* position;
    uint8_t numstepper;
    uint8_t idx;
};

{{ GENERATED_CODE }}


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

    if (isSettingUp()) {
        state->numstepper = getValue<input_NUM>(ctx);
        state->position = new long[state->numstepper - 1];
        state->idx = 0;
    }

    Type positions;

    positions.numstepper = state->numstepper;
    positions.position = state->position;
    positions.idx = state->idx;
    emitValue<output_MPOSI>(ctx, positions);


}