setspeed

ivanmason/accelstepper/setspeed

Sets the desired constant speed for use with runSpeed().
setspeed
@/setspeed
Sets the desired constant speed for use with runSpeed().
DEV@/accelstepper-device
SPDnumber
The desired constant speed in steps per second. Positive is clockwise. Speeds of more than 1000 steps per second are unreliable. Very slow speeds may be set (eg 0.00027777 for once per hour, approximately. Speed accuracy depends on the Arduino crystal. Jitter depends on how frequently you call the runSpeed() function. The speed will be limited by the current value of setMaxSpeed()
Dirboolean
clockwise = TRUE anticlockwise = False
UPDpulse
setspeed
DONE
speed
DEV
SPD
Dir
UPD
speednumber
DONEpulse
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 {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    if (!isInputDirty<input_UPD>(ctx))
        return;

    auto stepper = getValue<input_DEV>(ctx);
    float speed = getValue<input_SPD>(ctx);

   // stepper->setSpeed(speed);
    if(getValue<input_Dir>(ctx))
        stepper->setSpeed(speed);
    else stepper->setSpeed(-speed);

    emitValue<output_DONE>(ctx, 1);
}