carte esclave petit robot

Dependencies:   mbed Herkulex_Library_2019 actions_Gr ident_crac actions_Pr

Committer:
Artiom
Date:
Thu May 16 11:58:17 2019 +0000
Revision:
8:8aeb718824ea
Parent:
7:553f3f1c2c53
Child:
9:9833e788942b
ajout de la mediane sur les telemetres!

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Artiom 0:bc74da1c502f 1 #include "Capteur.h"
Artiom 0:bc74da1c502f 2 #include "mbed.h"
Artiom 0:bc74da1c502f 3 #include "Actionneurs.h"
Artiom 8:8aeb718824ea 4 #include "dt.h"
Artiom 8:8aeb718824ea 5
Artiom 0:bc74da1c502f 6
Artiom 0:bc74da1c502f 7 ///////////////////////////////////////Capteurs de Contact///////////////////////
Artiom 0:bc74da1c502f 8 DigitalIn capteur_contact_block(PB_15);
Artiom 0:bc74da1c502f 9 DigitalIn capteur_contact1(PB_4);
Artiom 0:bc74da1c502f 10 DigitalIn capteur_contact2(PB_5);
Artiom 0:bc74da1c502f 11 DigitalIn capteur_contact3(PH_1);
Artiom 0:bc74da1c502f 12 /////////////////////////////////////Lecture Batterie////////////////////////////
Artiom 0:bc74da1c502f 13 AnalogIn Val_batterie(PC_2);
Artiom 0:bc74da1c502f 14 ///////////////////////////////////Capteurs multiCouleurs////////////////////////
Artiom 0:bc74da1c502f 15 /////////////////////////////////////Capteurs monocouleur////////////////////////
Artiom 0:bc74da1c502f 16 DigitalIn monocouleur1(PC_15);
Artiom 0:bc74da1c502f 17 DigitalIn monocouleur2(PC_14);
Artiom 0:bc74da1c502f 18 DigitalIn monocouleur3(PB_10);
Artiom 0:bc74da1c502f 19 DigitalIn monocouleur4(PC_3);
Artiom 0:bc74da1c502f 20 /////////////////////////////////////Capteurs industriels////////////////////////
Artiom 0:bc74da1c502f 21 /*AnalogIn Capteur_indus1(PA_7);
Artiom 0:bc74da1c502f 22 AnalogIn Capteur_indus2(PA_6);
Artiom 0:bc74da1c502f 23 AnalogIn Capteur_indus3(PA_5);
Artiom 0:bc74da1c502f 24 AnalogIn Capteur_indus4(PA_4);
Artiom 0:bc74da1c502f 25 AnalogIn Capteur_indus5(PC_1);
Artiom 0:bc74da1c502f 26 AnalogIn Capteur_indus6(PC_0);*/
Artiom 0:bc74da1c502f 27
Artiom 0:bc74da1c502f 28 short distance_moyenne;
Artiom 0:bc74da1c502f 29
Artiom 8:8aeb718824ea 30 short lecture_telemetre(char numero_telemetre) // DEGUEUX MAIS FONCTIONNEL :')
Artiom 8:8aeb718824ea 31 {
Artiom 8:8aeb718824ea 32 f_mesure();
Artiom 8:8aeb718824ea 33 switch(numero_telemetre) {
Artiom 8:8aeb718824ea 34 case 1:
Artiom 8:8aeb718824ea 35 distance_moyenne=(short)DT1_trait_Ex;
Artiom 8:8aeb718824ea 36 break;
Artiom 8:8aeb718824ea 37
Artiom 8:8aeb718824ea 38 case 2:
Artiom 8:8aeb718824ea 39 distance_moyenne=(short)DT2_trait_Ex;
Artiom 8:8aeb718824ea 40 break;
Artiom 8:8aeb718824ea 41
Artiom 8:8aeb718824ea 42 case 3:
Artiom 8:8aeb718824ea 43 distance_moyenne=(short)DT3_trait_Ex;
Artiom 8:8aeb718824ea 44 break;
Artiom 8:8aeb718824ea 45
Artiom 8:8aeb718824ea 46 case 4:
Artiom 8:8aeb718824ea 47 distance_moyenne=(short)DT4_trait_Ex;
Artiom 8:8aeb718824ea 48 break;
Artiom 0:bc74da1c502f 49 }
Artiom 0:bc74da1c502f 50 return distance_moyenne;
Artiom 0:bc74da1c502f 51 }
Artiom 0:bc74da1c502f 52
Artiom 0:bc74da1c502f 53
Artiom 0:bc74da1c502f 54
Artiom 8:8aeb718824ea 55 int capteur_contact(void)
Artiom 8:8aeb718824ea 56 {
Artiom 8:8aeb718824ea 57 if(capteur_contact_block.read()==1) {
Artiom 0:bc74da1c502f 58 return 1;
Artiom 8:8aeb718824ea 59 } else {
Artiom 0:bc74da1c502f 60 return 0;
Artiom 0:bc74da1c502f 61 }
Artiom 0:bc74da1c502f 62 }