homing

Dependencies:   mbed

Revision:
2:ff77628098e4
Parent:
1:555373c1b9be
--- a/main.cpp	Thu Nov 01 10:34:03 2018 +0000
+++ b/main.cpp	Thu Nov 01 10:41:22 2018 +0000
@@ -13,7 +13,9 @@
 void translation_stop(){}
 void rotation_start(int a, int b){}
 void rotation_stop(){}
-int main(){
+
+void homing()
+{
     //translation home
     if (counts2 > ((tower_end_position - tower_1_position)/2)){
         translation_start(0,1);
@@ -29,19 +31,10 @@
         }
     else{}
     
-    //rotation home
-    if ((counts1 - (revcounts * (counts1 / revcounts))) > (rotation_end_position)){
-        rotation_start(0,1);
-        }
-    else{
-        rotation_start(1,1);
-        }
-    if ((counts1 - (revcounts * (counts1 / revcounts))) > (rotation_end_position - 100)){ //check if motor 1 is in the right position within 100 counts range
-        if ((counts1 - (revcounts * (counts1 / revcounts))) < (rotation_end_position + 100)){
-        rotation_stop();
-            }
-        else {}
-        }
-    else {}
     }
+    
+int main()
+{
+  homing();
+  }
   
\ No newline at end of file