dasf

Dependencies:   mbed a4988

Fork of Ex_Stepper by YX ZHANG

main.cpp

Committer:
glintligo
Date:
2018-05-02
Revision:
3:46647fcd0269
Parent:
2:c944fc6cdfb7
Child:
4:b371bc40be2a

File content as of revision 3:46647fcd0269:

#include "mbed.h"
#include "a4988.h"
/*Ticker ticker_step;
DigitalOut step(PB_0), dir(PB_1), en(PC_13);
volatile int remain;

void toggle_step() { //产生STEP脉冲信号
    if(remain == 0)
        return;
    if(step){
        step = 0; //STEP 1->0
        remain--;
    }else{
        step = 1; //STEP 0->1
    }
}
*/

Stepper moter(PB_3, PA_6,PA_12);
int main() {
  //  ticker_step.attach(&toggle_step, 0.0002);
   // en = 0; //Enable stepper driver
    moter.enable();
    //while (true) {
        moter.step(1,5000,3200);
        //wait(1.5);
        
        //moter.step(0,5000,3200);
        //wait(1.5);
        //dir = 0;
        //remain = 3200;
        //wait(1.5);
        //dir = 1;
       // remain = 3200;
       // wait(1.5);
   //}
}