programme course avec menu amélioré

Dependencies:   MMA8451Q mbed

Fork of Programme_course_2017_virage_ameliore by Freescale_Cachan

Committer:
leandre
Date:
Sat Mar 18 13:21:28 2017 +0000
Revision:
3:c0aae5aa230b
Parent:
2:a37de5eb8bf3
virage am?lior? 2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Freescale_cup 0:3ec7fc598e48 1
Freescale_cup 0:3ec7fc598e48 2
Freescale_cup 0:3ec7fc598e48 3 #ifndef TEST
Freescale_cup 0:3ec7fc598e48 4 #define TEST
Freescale_cup 0:3ec7fc598e48 5
Freescale_cup 0:3ec7fc598e48 6 #include "mbed.h"
Freescale_cup 0:3ec7fc598e48 7 #include "MMA8451Q.h"
Freescale_cup 0:3ec7fc598e48 8 #include "motor.h"
Freescale_cup 0:3ec7fc598e48 9
Freescale_cup 0:3ec7fc598e48 10 #define MMA8451_I2C_ADRESS (0x1d<<1)
Freescale_cup 0:3ec7fc598e48 11
Freescale_cup 0:3ec7fc598e48 12 #define FRQ_CLK 15000
Freescale_cup 0:3ec7fc598e48 13 #define FRQ_CYC 6000
Freescale_cup 0:3ec7fc598e48 14 #define AMIDTAB 64
Freescale_cup 0:3ec7fc598e48 15 #define BMIDTAB 63
Freescale_cup 0:3ec7fc598e48 16 #define BANDSIZE 4
Freescale_cup 0:3ec7fc598e48 17 #define MIN_INTE 0
Freescale_cup 0:3ec7fc598e48 18 #define MAX_INTE FRQ_CYC-500
Freescale_cup 0:3ec7fc598e48 19 #define INCREM_BALANCE 300
Freescale_cup 0:3ec7fc598e48 20 #define MARGE_LIGNE 5
Freescale_cup 0:3ec7fc598e48 21 #define MARGE_DISTANCE_LIGNE 10
leandre 2:a37de5eb8bf3 22 #define LUMI_MOYENNE 90
leandre 2:a37de5eb8bf3 23
Freescale_cup 0:3ec7fc598e48 24 #define CORRECTION_VIRAGE 1
Freescale_cup 0:3ec7fc598e48 25 #define MAX_BATTERY 1.3
Freescale_cup 0:3ec7fc598e48 26 #define SEUIL_NB_DERRIVEE 25
leandre 2:a37de5eb8bf3 27 #define KD 400 //valeur de base 400
Freescale_cup 0:3ec7fc598e48 28 #define KI 3
Freescale_cup 0:3ec7fc598e48 29
Freescale_cup 0:3ec7fc598e48 30 #define BOSSE_ACTIVE S2
Freescale_cup 0:3ec7fc598e48 31
Freescale_cup 0:3ec7fc598e48 32 #define VITESSE 40
leandre 2:a37de5eb8bf3 33
leandre 2:a37de5eb8bf3 34 #define TAILLE_TAB_INT 6
Freescale_cup 0:3ec7fc598e48 35 /***********************FONCTIONS**********************/
Freescale_cup 0:3ec7fc598e48 36 /**/ /****************CAMERA****************/ /**/
Freescale_cup 0:3ec7fc598e48 37 /**/ void F_GetData(); /**/
Freescale_cup 0:3ec7fc598e48 38 /**/ void F_CLK(); /**/
Freescale_cup 0:3ec7fc598e48 39 /**/ void Impulse_SI(); /**/
Freescale_cup 0:3ec7fc598e48 40 /**/ /**/
Freescale_cup 0:3ec7fc598e48 41 /**/ /***************SHIELD*****************/ /**/
Freescale_cup 0:3ec7fc598e48 42 /**/ void moteurs_arriere(); /**/
Freescale_cup 0:3ec7fc598e48 43 /**/ void test_servo(int time); /**/
Freescale_cup 0:3ec7fc598e48 44 /**/ void Get_pot_value(); /**/
Freescale_cup 0:3ec7fc598e48 45 /**/ /**/
Freescale_cup 0:3ec7fc598e48 46 /**/ /**********TRAITEMENT_IMG************/ /**/
Freescale_cup 0:3ec7fc598e48 47 /**/ void F_TraitementImage(); /**/
Freescale_cup 0:3ec7fc598e48 48 /**/ void F_BalanceBlancs(); /**/
Freescale_cup 0:3ec7fc598e48 49 /**/ void Gestion_bosse(); /**/
Freescale_cup 0:3ec7fc598e48 50 /**/ void T_image(); /**/
Freescale_cup 0:3ec7fc598e48 51 /**/ /**/
Freescale_cup 0:3ec7fc598e48 52 /**/ /**/
Freescale_cup 0:3ec7fc598e48 53 /**/ /***********AUTRES_FCT***************/ /**/
Freescale_cup 0:3ec7fc598e48 54 /**/ char middle_3(char *tab); /**/
Freescale_cup 0:3ec7fc598e48 55 /**/ int middle_3U(int *tab); /**/
Freescale_cup 0:3ec7fc598e48 56 /**/ float middle_3F(float *tab); /**/
Freescale_cup 0:3ec7fc598e48 57 /**/ void tri_a_bulle(char* t, int const size); /**/
Freescale_cup 0:3ec7fc598e48 58 /**/ void tri_a_bulleU(int* t, int const size); /**/
Freescale_cup 0:3ec7fc598e48 59 /**/ float tri_a_bulleF(float*t, int const size);/**/
Freescale_cup 0:3ec7fc598e48 60 /**/ unsigned char Moyenne(unsigned char *tab); /**/
Freescale_cup 0:3ec7fc598e48 61 /**/ char Moyenne2(char *tab, int nb); /**/
Freescale_cup 0:3ec7fc598e48 62 /**/ void menu(); /**/
Freescale_cup 0:3ec7fc598e48 63 /**/ void init_bary(); /**/
Freescale_cup 0:3ec7fc598e48 64 /**/ void fin_course(); /**/
Freescale_cup 0:3ec7fc598e48 65 /******************************************************/
Freescale_cup 0:3ec7fc598e48 66
Freescale_cup 0:3ec7fc598e48 67 /****************CAMERA****************/
Freescale_cup 0:3ec7fc598e48 68 extern DigitalOut SI;
Freescale_cup 0:3ec7fc598e48 69 extern DigitalOut CLK;
Freescale_cup 0:3ec7fc598e48 70 extern AnalogIn AIN;
Freescale_cup 0:3ec7fc598e48 71 extern unsigned char cam_data[128];
Freescale_cup 0:3ec7fc598e48 72 extern InterruptIn Int_clk;
Freescale_cup 0:3ec7fc598e48 73 extern char numero_data;
Freescale_cup 0:3ec7fc598e48 74 extern char clk_active;
Freescale_cup 0:3ec7fc598e48 75
Freescale_cup 0:3ec7fc598e48 76 /***************SHIELD*****************/
Freescale_cup 0:3ec7fc598e48 77 extern char bosse;
Freescale_cup 0:3ec7fc598e48 78 extern int ajust_vitesse;
Freescale_cup 0:3ec7fc598e48 79 extern int vitesse_virage;
Freescale_cup 0:3ec7fc598e48 80 extern DigitalOut BP1;
Freescale_cup 0:3ec7fc598e48 81 extern DigitalOut BP2;
Freescale_cup 0:3ec7fc598e48 82 extern DigitalOut led1;
Freescale_cup 0:3ec7fc598e48 83 extern DigitalOut led2;
Freescale_cup 0:3ec7fc598e48 84 extern DigitalOut led3;
Freescale_cup 0:3ec7fc598e48 85 extern DigitalOut led4;
Freescale_cup 0:3ec7fc598e48 86 extern DigitalIn S1;
Freescale_cup 0:3ec7fc598e48 87 extern DigitalIn S2;
Freescale_cup 0:3ec7fc598e48 88 extern DigitalIn S3;
Freescale_cup 0:3ec7fc598e48 89 extern DigitalIn S4;
Freescale_cup 0:3ec7fc598e48 90 extern AnalogIn pot1;
Freescale_cup 0:3ec7fc598e48 91 extern AnalogIn pot2;
Freescale_cup 0:3ec7fc598e48 92
leandre 2:a37de5eb8bf3 93 //extern DigitalOut RGB_R(LED_RED);
leandre 2:a37de5eb8bf3 94
Freescale_cup 0:3ec7fc598e48 95 /************TRAITEMENT_IMG************/
Freescale_cup 0:3ec7fc598e48 96 extern Ticker t_clk;
Freescale_cup 0:3ec7fc598e48 97 extern Ticker t_finInte;
Freescale_cup 0:3ec7fc598e48 98 extern int tempsInte;
Freescale_cup 0:3ec7fc598e48 99 extern int baricentre;
Freescale_cup 0:3ec7fc598e48 100 extern char arrivee;
Freescale_cup 0:3ec7fc598e48 101 extern int somme_derivee;
Freescale_cup 0:3ec7fc598e48 102 extern int seuil_der;
Freescale_cup 0:3ec7fc598e48 103 extern float last_three[3];
Freescale_cup 0:3ec7fc598e48 104 extern int bary_tab[3];
Freescale_cup 0:3ec7fc598e48 105 extern int bary_tab_bis[3];
Freescale_cup 0:3ec7fc598e48 106 extern int integral;
Freescale_cup 0:3ec7fc598e48 107 extern int new_bari;
Freescale_cup 0:3ec7fc598e48 108 extern int ralentire;
Freescale_cup 0:3ec7fc598e48 109 extern MMA8451Q acc;
Freescale_cup 0:3ec7fc598e48 110 extern char last_five[5];
leandre 2:a37de5eb8bf3 111 extern char mem_a;
leandre 2:a37de5eb8bf3 112 extern char mem_b;
leandre 2:a37de5eb8bf3 113 extern char Interval[TAILLE_TAB_INT];
Freescale_cup 0:3ec7fc598e48 114
Freescale_cup 0:3ec7fc598e48 115 /*************AUTRES_VAR***************/
Freescale_cup 0:3ec7fc598e48 116 extern Ticker t_cyc;
Freescale_cup 0:3ec7fc598e48 117 extern Serial pc;
Freescale_cup 0:3ec7fc598e48 118 extern Timer t_debut;
Freescale_cup 0:3ec7fc598e48 119 extern Timer t_ligne;
Freescale_cup 0:3ec7fc598e48 120 extern Timer timer;
Freescale_cup 0:3ec7fc598e48 121 extern int begin;
Freescale_cup 0:3ec7fc598e48 122 extern int VIT;
Freescale_cup 0:3ec7fc598e48 123 extern int KP;
Freescale_cup 0:3ec7fc598e48 124 extern int ligne_droite;
Freescale_cup 0:3ec7fc598e48 125
Freescale_cup 0:3ec7fc598e48 126
Freescale_cup 0:3ec7fc598e48 127
Freescale_cup 0:3ec7fc598e48 128
Freescale_cup 0:3ec7fc598e48 129
Freescale_cup 0:3ec7fc598e48 130
Freescale_cup 0:3ec7fc598e48 131
Freescale_cup 0:3ec7fc598e48 132
Freescale_cup 0:3ec7fc598e48 133
Freescale_cup 0:3ec7fc598e48 134
Freescale_cup 0:3ec7fc598e48 135
Freescale_cup 0:3ec7fc598e48 136 #endif /* !MLIB_H*/