Theo/Ludo/Joe / ER2_Labyrinthe_V3

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers fonction.cpp Source File

fonction.cpp

00001 #include "mbed.h"
00002 #include "fonction.h"
00003 
00004 int CRAN=0;
00005 float tour=0,rad=0, ms=0;
00006  void roule_motdroit (int vSensD, int vitesse)
00007 {
00008     if(vSensD==1){
00009     PWMD.pulsewidth_us(100-vitesse);
00010     SensD=1;}
00011     else {
00012     PWMD.pulsewidth_us(vitesse);
00013     SensD=0;}
00014 }
00015 
00016 void roule_motgauche (int vSensG, int vitesse)
00017 {
00018     if(vSensG==1) {
00019     PWMG.pulsewidth_us(100-vitesse);
00020     SensG=1;}
00021     else {
00022     PWMG.pulsewidth_us(vitesse);
00023     SensG=0;}
00024 }
00025 
00026 void increment (void)
00027 {
00028      CRAN++;
00029      //printf("cran=%d\n\r",CRAN);
00030 }
00031 
00032 void calcul_vit (void)
00033 {
00034        
00035     tour=CRAN*1.1;         //En cm/seconde
00036     ms=tour/100;           // en m/s
00037     rad=tour*2*3.14/12;         //Les 60 se simplifient pour =>> rad/seconde
00038     
00039     printf("rad/s =%g   m/s=%g\n\r",rad,ms);
00040     CRAN=0;
00041 }