vor bas

Dependencies:   Encoder mbed

Revision:
1:d157905a98d1
Parent:
0:b48b8c18b1bd
Child:
2:2b64e8a0a075
--- a/main.cpp	Thu Oct 30 17:10:14 2014 +0000
+++ b/main.cpp	Fri Oct 31 10:15:16 2014 +0000
@@ -20,35 +20,34 @@
 float out_i = 0;
 int y;
 
-
-int main()
+void batposition(int y)
 {
-    while(1){
-        cout<<"typ 1 voor links, 2 voor rechts: "<<endl;
-    cin>>y;
     switch(y) {
         case 1:
             cout<<"links"<<endl;
-            dir = 1;
+            dir.write(1);
             pwm.write(0.4);
-            wait(0.01);
+            wait(0.03);
             pwm.write(0);
             break;
         case 2:
             cout<<"rechts"<<endl;
-            dir = 0;
+            dir.write(0);
             pwm.write(0.4);
-            wait(0.01);
+            wait(0.03);
             pwm.write(0);
             break;
-        case 3:
-            cout<<encoderA.getPosition()<<endl;
-            break;
-        case 4:
-             encoderA.setPosition(0);
-             break;
+
     }
+
 }
 
+int main()
+{
+    while(1) {
+        cout<<"typ 1 voor links, 2 voor rechts: "<<endl;
+        cin>>y;
+        batposition(y);
 
+    }
 }
\ No newline at end of file