Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 3:1fbaadae09f8, committed 2014-05-28
- Comitter:
- akul
- Date:
- Wed May 28 13:13:49 2014 +0000
- Parent:
- 2:d439dbbc522f
- Commit message:
- redid code for startpoint 1 -- includes any and all potential intersections (i.e. intersections + corners)
Changed in this revision
| Mapping.cpp | Show annotated file Show diff for this revision Revisions of this file | 
--- a/Mapping.cpp	Wed May 28 11:29:42 2014 +0000
+++ b/Mapping.cpp	Wed May 28 13:13:49 2014 +0000
@@ -16,60 +16,27 @@
     switch(startpoint){
         case 1:
             if(endpoint == 2){
-                while(count < 2){
+                while(count < 4){
                     if(intersection == true){
                         count++;
                         intersection = false;
                         if(count == 1){
-                            thinggy.left(speed);
+                            thinggy.right(speed);
                         }
                         if(count == 2){
                             thinggy.left(speed);
                         }
+                        if(count == 3){
+                            thinggy.left(speed);
+                        }
+                        if(count == 4){
+                            thinggy.right(speed);
+                        }
                     }
                 }
                 count = 0;
             }
             else if(endpoint == 3){
-                while(count < 3){
-                    if(intersection == true){
-                        count++;
-                        intersection = false;
-                        if(count == 1){
-                            thinggy.left(speed);
-                        }
-                        if(count == 2){
-                            thinggy.forward(speed);
-                        }
-                        if(count == 2){
-                            thinggy.forward(speed);
-                        }
-                    }
-                }
-                count = 0;
-                }
-            else if(endpoint == 4){
-                while(count < 4){
-                    if(intersection == true){
-                        count++;
-                        intersection = false;
-                        if(count == 1){
-                            thinggy.left(speed);
-                        }
-                        if(count == 2){
-                            thinggy.forward(speed);
-                        }
-                        if(count == 3){
-                            thinggy.right(speed);
-                        }
-                        if(count == 4){
-                            thinggy.left(speed);
-                        }
-                    }
-                }
-                count = 0;
-                }
-            else if(endpoint == 5){
                 while(count < 4){
                     if(intersection == true){
                         count++;
@@ -78,28 +45,94 @@
                             thinggy.right(speed);
                         }
                         if(count == 2){
+                            thinggy.left(speed);
+                        }
+                        if(count == 3){
+                            thinggy.forward(speed);
+                        }
+                        if(count == 4){
                             thinggy.forward(speed);
                         }
+                    }
+                }
+                count = 0;
+                }
+            else if(endpoint == 4){
+                while(count < 5){
+                    if(intersection == true){
+                        count++;
+                        intersection = false;
+                        if(count == 1){
+                            thinggy.right(speed);
+                        }
+                        if(count == 2){
+                            thinggy.left(speed);
+                        }
                         if(count == 3){
-                            thinggy.right(speed);
+                            thinggy.forward(speed);
                         }
                         if(count == 4){
                             thinggy.right(speed);
                         }
+                        if(count == 5){
+                            thinggy.left(speed);
+                        }
+                    }
+                }
+                count = 0;
+                }
+            else if(endpoint == 5){
+                while(count < 9){
+                    if(intersection == true){
+                        count++;
+                        intersection = false;
+                        if(count == 1){
+                            thinggy.right(speed);
+                        }
+                        if(count == 2){
+                            thinggy.right(speed);
+                        }
+                        if(count == 3){
+                            thinggy.left(speed);
+                        }
+                        if(count == 4){
+                            thinggy.forward(speed);
+                        }
+                        if(count == 5){
+                            thinggy.left(speed);
+                        }
+                        if(count == 6){
+                            thinggy.right(speed);
+                        }
+                        if(count == 7){
+                            thinggy.right(speed);
+                        }
+                        if(count == 8){
+                            thinggy.right(speed);
+                        }
+                        if(count == 9){
+                            thinggy.left(speed);
+                        }
                     }
                 }
                 count = 0;
                 }
             else if(endpoint == 6){
-                while(count < 2){
+                while(count < 4){
                     if(intersection == true){
                         count++;
                         intersection = false;
                         if(count == 1){
+                            thinggy.right(speed);
+                        }
+                        if(count == 2){
+                            thinggy.right(speed);
+                        }
+                        if(count == 3){
                             thinggy.left(speed);
                         }
-                        if(count == 2){
-                            thinggy.forward(speed);
+                        if(count == 4){
+                            thinggy.right(speed);
                         }
                     }
                 }