carte esclave petit robot

Dependencies:   mbed Herkulex_Library_2019 actions_Gr ident_crac actions_Pr

Committer:
Artiom
Date:
Sun May 26 10:51:35 2019 +0000
Revision:
44:381ecf63e6ab
Parent:
25:9627700d989f

        

Who changed what in which revision?

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