stop()


Description

This function stops driving a motor immediately.

Syntax

step.stop() step.stop(decel)

Parameters

decel - a positive integer value which represents the deceleration speed in pps/s unit

※ pps: pulse per second

Returns

none

Example

#include <PhpocExpansion.h>
#include <Phpoc.h>

byte spcId = 1;

ExpansionStepper step(spcId);

int state;

void setup() {
    Serial.begin(9600);
    while(!Serial)
        ;

    Phpoc.begin(PF_LOG_SPI | PF_LOG_NET);
    Expansion.begin();

    Serial.println(step.getPID());
    Serial.println(step.getName());

    step.setMode(4);
    step.setVrefStop(2);
    step.setVrefDrive(8);
    step.setSpeed(400);
    step.setAccel(1000);

    step.stepGoto(40000);
}

void loop() {
    state = step.getEio(0);

    if(state == 0)
        step.stop();

    delay(1);
}