Final version of stepper motor demo

Dependencies:   Stepper_Motor_X27168 mbed

Fork of Stepper_Motor_Demo by Hanbin Ying

main.cpp

Committer:
yhbyhb4433
Date:
2016-03-16
Revision:
2:5c8e6d22f773
Parent:
1:5de876de6423

File content as of revision 2:5c8e6d22f773:

#include "mbed.h"
#include "StepperMotor_X27168.h"

StepperMotor_X27168 smotor(p25, p26, p23, p22);
int main() {

    smotor.init(); //initialize the motor
    
    smotor.set_speed(800); //set the speed to 500 steps per second
    
    smotor.angle_position(45);
    wait(1);
    
    smotor.angle_position(270);
    wait(1);
    
    smotor.angle_position(90);
    wait(1);
    
    smotor.angle_position(180);
    wait(1);
    
    smotor.angle_position(315);
    wait(1);
    
    smotor.angle_position(45);
    wait(1);
    
    smotor.angle_position(0);
    wait(1);
    
}