tim004 tim004
/
Projekat
pomocni program Sumejja Porča Almir HUsić
Diff: main.cpp
- Revision:
- 0:8e21b0589b4a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon May 19 11:53:43 2014 +0000 @@ -0,0 +1,33 @@ + + +#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(); + + } +} \ No newline at end of file