projet neotim mpp / Mbed 2 deprecated projetv2

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
jdeschamps
Date:
Mon May 04 15:21:41 2020 +0000
Parent:
7:f9a7d4c88daa
Commit message:
projetv2;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon May 04 15:00:29 2020 +0000
+++ b/main.cpp	Mon May 04 15:21:41 2020 +0000
@@ -33,7 +33,7 @@
     printf("Le nombre de pas est de : %d \n", compteur);
     }
     
-void Interruption_timer() {
+void Interruption_Period() {
     if(sens==0) 
     {
         pas++;
@@ -107,8 +107,6 @@
 
 int main(void)
 {
-    mon_IT.attach(&Interruption_timer,0.5); // l'interruption est associée au programme Interruption_timer et s'exécute toutes les 0.5s
-                                            // pour stopper mon_IT.detach();
     sw3.rise(&Interruption_KBI1);
     sw2.rise(&Interruption_KBI2);
     while(1)
@@ -120,12 +118,42 @@
            
            if(strcmp(message,"monte_v1")==0)
      {
+         mon_IT.attach(&Interruption_Period,0.5);
          sens=0; // marche avant
          pwma=1;
      }
      
      else if(strcmp(message,"descend_v1")==0)
      {
+         mon_IT.attach(&Interruption_Period,0.5);
+         sens=1; // marche arriere
+         pwma=1;
+     }
+     
+     else if(strcmp(message,"monte_v2")==0)
+     {
+         mon_IT.attach(&Interruption_Period,0.1);
+         sens=0; // marche avant
+         pwma=1;
+     }
+     
+     else if(strcmp(message,"descend_v2")==0)
+     {
+         mon_IT.attach(&Interruption_Period,0.1);
+         sens=1; // marche arriere
+         pwma=1;
+     }
+     
+     else if(strcmp(message,"monte_v3")==0)
+     {
+         mon_IT.attach(&Interruption_Period,0.05);
+         sens=0; // marche avant
+         pwma=1;
+     }
+     
+     else if(strcmp(message,"descend_v3")==0)
+     {
+         mon_IT.attach(&Interruption_Period,0.05);
          sens=1; // marche arriere
          pwma=1;
       }