tim004 tim004
/
Projekat
pomocni program Sumejja Porča Almir HUsić
Revision 0:8e21b0589b4a, committed 2014-05-19
- Comitter:
- tim004
- Date:
- Mon May 19 11:53:43 2014 +0000
- Commit message:
- Projekat - program za motor; Sumejja Porca; Almir Husic
Changed in this revision
--- /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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon May 19 11:53:43 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sMotor.lib Mon May 19 11:53:43 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/XtaticO/code/sMotor/#4b3b9e047ce3