programme course avec menu amélioré

Dependencies:   MMA8451Q mbed

Fork of Programme_course_2 by Freescale_Cachan

Committer:
Freescale_cup
Date:
Thu Jan 26 07:37:45 2017 +0000
Revision:
0:3ec7fc598e48
Child:
1:000a03402c6e
Programme de base

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
Freescale_cup 0:3ec7fc598e48 22 #define LUMI_MOYENNE 80
Freescale_cup 0:3ec7fc598e48 23 #define CORRECTION_VIRAGE 1
Freescale_cup 0:3ec7fc598e48 24 #define MAX_BATTERY 1.3
Freescale_cup 0:3ec7fc598e48 25 #define SEUIL_NB_DERRIVEE 25
Freescale_cup 0:3ec7fc598e48 26 #define KD 400
Freescale_cup 0:3ec7fc598e48 27 #define KI 3
Freescale_cup 0:3ec7fc598e48 28
Freescale_cup 0:3ec7fc598e48 29 #define BOSSE_ACTIVE S2
Freescale_cup 0:3ec7fc598e48 30
Freescale_cup 0:3ec7fc598e48 31 #define VITESSE 40
Freescale_cup 0:3ec7fc598e48 32 /***********************FONCTIONS**********************/
Freescale_cup 0:3ec7fc598e48 33 /**/ /****************CAMERA****************/ /**/
Freescale_cup 0:3ec7fc598e48 34 /**/ void F_GetData(); /**/
Freescale_cup 0:3ec7fc598e48 35 /**/ void F_CLK(); /**/
Freescale_cup 0:3ec7fc598e48 36 /**/ void Impulse_SI(); /**/
Freescale_cup 0:3ec7fc598e48 37 /**/ /**/
Freescale_cup 0:3ec7fc598e48 38 /**/ /***************SHIELD*****************/ /**/
Freescale_cup 0:3ec7fc598e48 39 /**/ void moteurs_arriere(); /**/
Freescale_cup 0:3ec7fc598e48 40 /**/ void test_servo(int time); /**/
Freescale_cup 0:3ec7fc598e48 41 /**/ void Get_pot_value(); /**/
Freescale_cup 0:3ec7fc598e48 42 /**/ /**/
Freescale_cup 0:3ec7fc598e48 43 /**/ /**********TRAITEMENT_IMG************/ /**/
Freescale_cup 0:3ec7fc598e48 44 /**/ void F_TraitementImage(); /**/
Freescale_cup 0:3ec7fc598e48 45 /**/ void F_BalanceBlancs(); /**/
Freescale_cup 0:3ec7fc598e48 46 /**/ void Gestion_bosse(); /**/
Freescale_cup 0:3ec7fc598e48 47 /**/ void T_image(); /**/
Freescale_cup 0:3ec7fc598e48 48 /**/ /**/
Freescale_cup 0:3ec7fc598e48 49 /**/ /**/
Freescale_cup 0:3ec7fc598e48 50 /**/ /***********AUTRES_FCT***************/ /**/
Freescale_cup 0:3ec7fc598e48 51 /**/ char middle_3(char *tab); /**/
Freescale_cup 0:3ec7fc598e48 52 /**/ int middle_3U(int *tab); /**/
Freescale_cup 0:3ec7fc598e48 53 /**/ float middle_3F(float *tab); /**/
Freescale_cup 0:3ec7fc598e48 54 /**/ void tri_a_bulle(char* t, int const size); /**/
Freescale_cup 0:3ec7fc598e48 55 /**/ void tri_a_bulleU(int* t, int const size); /**/
Freescale_cup 0:3ec7fc598e48 56 /**/ float tri_a_bulleF(float*t, int const size);/**/
Freescale_cup 0:3ec7fc598e48 57 /**/ unsigned char Moyenne(unsigned char *tab); /**/
Freescale_cup 0:3ec7fc598e48 58 /**/ char Moyenne2(char *tab, int nb); /**/
Freescale_cup 0:3ec7fc598e48 59 /**/ void menu(); /**/
Freescale_cup 0:3ec7fc598e48 60 /**/ void init_bary(); /**/
Freescale_cup 0:3ec7fc598e48 61 /**/ void fin_course(); /**/
Freescale_cup 0:3ec7fc598e48 62 /******************************************************/
Freescale_cup 0:3ec7fc598e48 63
Freescale_cup 0:3ec7fc598e48 64 /****************CAMERA****************/
Freescale_cup 0:3ec7fc598e48 65 extern DigitalOut SI;
Freescale_cup 0:3ec7fc598e48 66 extern DigitalOut CLK;
Freescale_cup 0:3ec7fc598e48 67 extern AnalogIn AIN;
Freescale_cup 0:3ec7fc598e48 68 extern unsigned char cam_data[128];
Freescale_cup 0:3ec7fc598e48 69 extern InterruptIn Int_clk;
Freescale_cup 0:3ec7fc598e48 70 extern char numero_data;
Freescale_cup 0:3ec7fc598e48 71 extern char clk_active;
Freescale_cup 0:3ec7fc598e48 72
Freescale_cup 0:3ec7fc598e48 73 /***************SHIELD*****************/
Freescale_cup 0:3ec7fc598e48 74 extern char bosse;
Freescale_cup 0:3ec7fc598e48 75 extern int ajust_vitesse;
Freescale_cup 0:3ec7fc598e48 76 extern int vitesse_virage;
Freescale_cup 0:3ec7fc598e48 77 extern DigitalOut BP1;
Freescale_cup 0:3ec7fc598e48 78 extern DigitalOut BP2;
Freescale_cup 0:3ec7fc598e48 79 extern DigitalOut led1;
Freescale_cup 0:3ec7fc598e48 80 extern DigitalOut led2;
Freescale_cup 0:3ec7fc598e48 81 extern DigitalOut led3;
Freescale_cup 0:3ec7fc598e48 82 extern DigitalOut led4;
Freescale_cup 0:3ec7fc598e48 83 extern DigitalIn S1;
Freescale_cup 0:3ec7fc598e48 84 extern DigitalIn S2;
Freescale_cup 0:3ec7fc598e48 85 extern DigitalIn S3;
Freescale_cup 0:3ec7fc598e48 86 extern DigitalIn S4;
Freescale_cup 0:3ec7fc598e48 87 extern AnalogIn pot1;
Freescale_cup 0:3ec7fc598e48 88 extern AnalogIn pot2;
Freescale_cup 0:3ec7fc598e48 89
Freescale_cup 0:3ec7fc598e48 90 /************TRAITEMENT_IMG************/
Freescale_cup 0:3ec7fc598e48 91 extern Ticker t_clk;
Freescale_cup 0:3ec7fc598e48 92 extern Ticker t_finInte;
Freescale_cup 0:3ec7fc598e48 93 extern int tempsInte;
Freescale_cup 0:3ec7fc598e48 94 extern int baricentre;
Freescale_cup 0:3ec7fc598e48 95 extern char arrivee;
Freescale_cup 0:3ec7fc598e48 96 extern int somme_derivee;
Freescale_cup 0:3ec7fc598e48 97 extern int seuil_der;
Freescale_cup 0:3ec7fc598e48 98 extern float last_three[3];
Freescale_cup 0:3ec7fc598e48 99 extern int bary_tab[3];
Freescale_cup 0:3ec7fc598e48 100 extern int bary_tab_bis[3];
Freescale_cup 0:3ec7fc598e48 101 extern int integral;
Freescale_cup 0:3ec7fc598e48 102 extern int new_bari;
Freescale_cup 0:3ec7fc598e48 103 extern int ralentire;
Freescale_cup 0:3ec7fc598e48 104 extern MMA8451Q acc;
Freescale_cup 0:3ec7fc598e48 105 extern char last_five[5];
Freescale_cup 0:3ec7fc598e48 106
Freescale_cup 0:3ec7fc598e48 107 /*************AUTRES_VAR***************/
Freescale_cup 0:3ec7fc598e48 108 extern Ticker t_cyc;
Freescale_cup 0:3ec7fc598e48 109 extern Serial pc;
Freescale_cup 0:3ec7fc598e48 110 extern Timer t_debut;
Freescale_cup 0:3ec7fc598e48 111 extern Timer t_ligne;
Freescale_cup 0:3ec7fc598e48 112 extern Timer timer;
Freescale_cup 0:3ec7fc598e48 113 extern int begin;
Freescale_cup 0:3ec7fc598e48 114 extern int VIT;
Freescale_cup 0:3ec7fc598e48 115 extern int KP;
Freescale_cup 0:3ec7fc598e48 116 extern int ligne_droite;
Freescale_cup 0:3ec7fc598e48 117
Freescale_cup 0:3ec7fc598e48 118
Freescale_cup 0:3ec7fc598e48 119
Freescale_cup 0:3ec7fc598e48 120
Freescale_cup 0:3ec7fc598e48 121
Freescale_cup 0:3ec7fc598e48 122
Freescale_cup 0:3ec7fc598e48 123
Freescale_cup 0:3ec7fc598e48 124
Freescale_cup 0:3ec7fc598e48 125
Freescale_cup 0:3ec7fc598e48 126
Freescale_cup 0:3ec7fc598e48 127
Freescale_cup 0:3ec7fc598e48 128 #endif /* !MLIB_H*/