Better driving method; calibration routine

Dependencies:   Stepper_Motor_X27168 mbed

Fork of ECE_4180_Lab_4 by Stepper Motor

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "StepperMotor_X27168.h"
00003 
00004 StepperMotor_X27168 smotor(p25, p26, p23, p22);
00005 int main() {
00006 
00007     smotor.init(); //initialize the motor
00008     
00009     smotor.set_speed(500); //set the speed to 500 steps per second
00010     
00011     smotor.angle_position(45);
00012     wait(1);
00013     
00014     smotor.angle_position(270);
00015     wait(1);
00016     
00017     smotor.angle_position(90);
00018     wait(1);
00019     
00020     smotor.angle_position(180);
00021     wait(1);
00022     
00023     smotor.angle_position(315);
00024     wait(1);
00025     
00026     smotor.angle_position(45);
00027     wait(1);
00028     
00029     smotor.angle_position(0);
00030     wait(1);
00031     
00032 }