pomocni program Sumejja Porča Almir HUsić

Dependencies:   mbed sMotor

main.cpp

Committer:
tim004
Date:
2014-05-19
Revision:
0:8e21b0589b4a

File content as of revision 0:8e21b0589b4a:

    

#include "mbed.h"
#include "sMotor.h"
 
sMotor motor(dp9, dp10, dp11, dp13); // creates new stepper motor: IN1, IN2, IN3, IN4
 
int step_speed = 1200 ; // set default motor speed
int numstep = 512 ; // defines full turn of 360 degree
int direction = 0; //0 for right, 1 for left
 
 void screenMenu()
 {
        // Screen Menu
            //pc.printf("Default Speed: %d, press: \n\r",step_speed);
            //pc.printf("1- to choose random angle to set new motor state\n\r");
            //pc.printf("2- to change the motor direction\n\r");
            //pc.printf("3- to change the rotation speed\n\r");
            //pc.printf("4- to start/stop the motor\n\r");
}
int main() {
    
    screenMenu();
    int angle(0);
    while (1) {                
            
                motor.step(numstep / 360 * (angle % 360), direction, step_speed); // number of steps, direction, speed
                angle++;
                wait(0.1);
               // screenMenu();
            
              }
}