v7

Dependents:   robot_final

Files at this revision

API Documentation at this revision

Comitter:
aure
Date:
Thu Mar 23 12:47:04 2017 +0000
Parent:
9:aff70d8f388a
Commit message:
jgjgj

Changed in this revision

Robot.cpp Show annotated file Show diff for this revision Revisions of this file
Robot.h Show annotated file Show diff for this revision Revisions of this file
diff -r aff70d8f388a -r d88127a08e44 Robot.cpp
--- a/Robot.cpp	Thu Mar 23 09:46:24 2017 +0000
+++ b/Robot.cpp	Thu Mar 23 12:47:04 2017 +0000
@@ -37,16 +37,33 @@
         return pattern;
     }
     
-    void Robot::action(char idAction,char mode){
-        int temps;
+    void Robot::action(char idAction,char mode,char vitesse){
+        float temps;
         
-        if(mode=='a'){
-            temps = 0.1;
+        if(mode=='m'){
+            temps =0.1;
         }
         else{
             temps = 2;
         }
         
+       switch(vitesse)
+       {
+            case '1':deplacement.setVitesse(0.1);
+            break;
+             case '2':deplacement.setVitesse(0.25);
+            break;
+             case '3':deplacement.setVitesse(0.5);
+            break;
+             case '4':deplacement.setVitesse(0.75);
+            break;
+             case '5':deplacement.setVitesse(1);
+            break;
+            default:deplacement.setVitesse(0.1);
+            break;
+        
+        }
+        
         switch(idAction){
         
             // deplacement simple
diff -r aff70d8f388a -r d88127a08e44 Robot.h
--- a/Robot.h	Thu Mar 23 09:46:24 2017 +0000
+++ b/Robot.h	Thu Mar 23 12:47:04 2017 +0000
@@ -29,7 +29,7 @@
      LED getLed();
      Deplacement getDeplacement();
      Pattern getPattern();
-     void action(char idAction, char mode);
+     void action(char idAction, char mode,char vitesse);
      void utiliserUltrason();
      void afficherObstacle();
      void scanneEnvironement();