pomocni program Sumejja Porča Almir HUsić

Dependencies:   mbed sMotor

Files at this revision

API Documentation at this revision

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

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
sMotor.lib Show annotated file Show diff for this revision Revisions of this file
--- /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