Porca Sumejja ALmir Husic

Dependencies:   mbed sMotor

Committer:
tim004
Date:
Mon May 19 14:22:14 2014 +0000
Revision:
0:6051895680ca
Projekat; pomocni dio ;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tim004 0:6051895680ca 1 #include "mbed.h"
tim004 0:6051895680ca 2 #include "sMotor.h"
tim004 0:6051895680ca 3
tim004 0:6051895680ca 4 sMotor motor(dp9, dp10, dp11, dp13); // creates new stepper motor: IN1, IN2, IN3, IN4
tim004 0:6051895680ca 5
tim004 0:6051895680ca 6 int step_speed = 1200 ; // set default motor speed
tim004 0:6051895680ca 7 int numstep = 512 ; // defines full turn of 360 degree
tim004 0:6051895680ca 8 int direction = 0; //0 for right, 1 for left
tim004 0:6051895680ca 9
tim004 0:6051895680ca 10 int main() {
tim004 0:6051895680ca 11
tim004 0:6051895680ca 12 int angle(0);
tim004 0:6051895680ca 13 while (1) {
tim004 0:6051895680ca 14
tim004 0:6051895680ca 15 motor.step(numstep / 360 * (angle % 360), direction, step_speed); // number of steps, direction, speed
tim004 0:6051895680ca 16 angle++;
tim004 0:6051895680ca 17 wait(0.1);
tim004 0:6051895680ca 18 }
tim004 0:6051895680ca 19 }