programme ines avce xbee

Dependencies:   MMA8451Q mbed xbee_lib

Fork of Programme_course by Freescale_Cachan

Committer:
inesmas3
Date:
Wed Feb 08 15:16:04 2017 +0000
Revision:
1:4a9196bcf97a
Parent:
0:3ec7fc598e48
Child:
2:ddf9879f0e25
modif de ines updated au 8 fev 17

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;
inesmas3 1:4a9196bcf97a 76 extern int ajust_vit_bosse;
Freescale_cup 0:3ec7fc598e48 77 extern int vitesse_virage;
Freescale_cup 0:3ec7fc598e48 78 extern DigitalOut BP1;
Freescale_cup 0:3ec7fc598e48 79 extern DigitalOut BP2;
Freescale_cup 0:3ec7fc598e48 80 extern DigitalOut led1;
Freescale_cup 0:3ec7fc598e48 81 extern DigitalOut led2;
Freescale_cup 0:3ec7fc598e48 82 extern DigitalOut led3;
Freescale_cup 0:3ec7fc598e48 83 extern DigitalOut led4;
inesmas3 1:4a9196bcf97a 84 extern DigitalIn S1; // switch 1
inesmas3 1:4a9196bcf97a 85 extern DigitalIn S2; // switch 2
Freescale_cup 0:3ec7fc598e48 86 extern DigitalIn S3;
Freescale_cup 0:3ec7fc598e48 87 extern DigitalIn S4;
Freescale_cup 0:3ec7fc598e48 88 extern AnalogIn pot1;
Freescale_cup 0:3ec7fc598e48 89 extern AnalogIn pot2;
Freescale_cup 0:3ec7fc598e48 90
Freescale_cup 0:3ec7fc598e48 91 /************TRAITEMENT_IMG************/
Freescale_cup 0:3ec7fc598e48 92 extern Ticker t_clk;
Freescale_cup 0:3ec7fc598e48 93 extern Ticker t_finInte;
Freescale_cup 0:3ec7fc598e48 94 extern int tempsInte;
Freescale_cup 0:3ec7fc598e48 95 extern int baricentre;
Freescale_cup 0:3ec7fc598e48 96 extern char arrivee;
Freescale_cup 0:3ec7fc598e48 97 extern int somme_derivee;
Freescale_cup 0:3ec7fc598e48 98 extern int seuil_der;
Freescale_cup 0:3ec7fc598e48 99 extern float last_three[3];
Freescale_cup 0:3ec7fc598e48 100 extern int bary_tab[3];
Freescale_cup 0:3ec7fc598e48 101 extern int bary_tab_bis[3];
Freescale_cup 0:3ec7fc598e48 102 extern int integral;
Freescale_cup 0:3ec7fc598e48 103 extern int new_bari;
Freescale_cup 0:3ec7fc598e48 104 extern int ralentire;
Freescale_cup 0:3ec7fc598e48 105 extern MMA8451Q acc;
Freescale_cup 0:3ec7fc598e48 106 extern char last_five[5];
Freescale_cup 0:3ec7fc598e48 107
Freescale_cup 0:3ec7fc598e48 108 /*************AUTRES_VAR***************/
Freescale_cup 0:3ec7fc598e48 109 extern Ticker t_cyc;
Freescale_cup 0:3ec7fc598e48 110 extern Serial pc;
Freescale_cup 0:3ec7fc598e48 111 extern Timer t_debut;
Freescale_cup 0:3ec7fc598e48 112 extern Timer t_ligne;
Freescale_cup 0:3ec7fc598e48 113 extern Timer timer;
Freescale_cup 0:3ec7fc598e48 114 extern int begin;
Freescale_cup 0:3ec7fc598e48 115 extern int VIT;
Freescale_cup 0:3ec7fc598e48 116 extern int KP;
Freescale_cup 0:3ec7fc598e48 117 extern int ligne_droite;
Freescale_cup 0:3ec7fc598e48 118
Freescale_cup 0:3ec7fc598e48 119
inesmas3 1:4a9196bcf97a 120 extern DigitalOut led5;
inesmas3 1:4a9196bcf97a 121 extern DigitalOut led6;
inesmas3 1:4a9196bcf97a 122 extern DigitalOut led7;
inesmas3 1:4a9196bcf97a 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
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 #endif /* !MLIB_H*/