Beganovic Benjamin Babic Mirhat

Dependencies:   mbed sMotor

Files at this revision

API Documentation at this revision

Comitter:
tim010
Date:
Mon May 12 10:04:03 2014 +0000
Commit message:
LV9-GRUPA2-TIM010-ZADATAK2

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 12 10:04:03 2014 +0000
@@ -0,0 +1,49 @@
+#include "mbed.h"
+#include "sMotor.h"
+
+Serial pc(USBTX, USBRX);
+sMotor motor(dp9, dp10, dp11, dp13);
+Ticker flipper;
+
+
+
+int brzina = 1200;
+int smjer = 0;
+bool upaljen = false;
+int pomak = 1;
+
+void okreci()
+{
+    if(upaljen) motor.step(0.3, smjer, brzina);
+}
+
+int main() {
+    
+    char izbor;
+    flipper.attach(&okreci, 1);
+    while(1)
+    {
+        pc.printf("Unesite broj od 1 do 4\n");
+        izbor = pc.getc();
+        if(izbor == '1'){
+            pc.printf("Unesite stepene od 0 do 360");
+            pc.scanf("%d", &pomak);
+            int brojKoraka = (int)pomak;
+            motor.step(brojKoraka, smjer, brzina);
+        }
+        else if(izbor == '2'){
+            smjer = (smjer + 1) % 2;
+        }
+        else if(izbor == '3'){
+            pc.printf("Unesite novu brzinu");
+            pc.scanf("%d", &brzina); 
+              
+        }
+        else if(izbor == '4'){
+            
+            if(upaljen == false) upaljen = true;
+            else upaljen = false;
+        }
+        
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon May 12 10:04:03 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 12 10:04:03 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/XtaticO/code/sMotor/#4b3b9e047ce3