carte esclave petit robot
Dependencies: mbed Herkulex_Library_2019 actions_Gr ident_crac actions_Pr
Capteurs/Capteur.cpp@9:9833e788942b, 2019-05-17 (annotated)
- Committer:
- Artiom
- Date:
- Fri May 17 10:39:09 2019 +0000
- Revision:
- 9:9833e788942b
- Parent:
- 8:8aeb718824ea
- Child:
- 27:9627700d989f
timer sur DT meilleur echantillonage
Who changed what in which revision?
User | Revision | Line number | New 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 | switch(numero_telemetre) { |
Artiom | 8:8aeb718824ea | 33 | case 1: |
Artiom | 8:8aeb718824ea | 34 | distance_moyenne=(short)DT1_trait_Ex; |
Artiom | 8:8aeb718824ea | 35 | break; |
Artiom | 8:8aeb718824ea | 36 | |
Artiom | 8:8aeb718824ea | 37 | case 2: |
Artiom | 8:8aeb718824ea | 38 | distance_moyenne=(short)DT2_trait_Ex; |
Artiom | 8:8aeb718824ea | 39 | break; |
Artiom | 8:8aeb718824ea | 40 | |
Artiom | 8:8aeb718824ea | 41 | case 3: |
Artiom | 8:8aeb718824ea | 42 | distance_moyenne=(short)DT3_trait_Ex; |
Artiom | 8:8aeb718824ea | 43 | break; |
Artiom | 8:8aeb718824ea | 44 | |
Artiom | 8:8aeb718824ea | 45 | case 4: |
Artiom | 8:8aeb718824ea | 46 | distance_moyenne=(short)DT4_trait_Ex; |
Artiom | 8:8aeb718824ea | 47 | break; |
Artiom | 0:bc74da1c502f | 48 | } |
Artiom | 0:bc74da1c502f | 49 | return distance_moyenne; |
Artiom | 0:bc74da1c502f | 50 | } |
Artiom | 0:bc74da1c502f | 51 | |
Artiom | 0:bc74da1c502f | 52 | |
Artiom | 0:bc74da1c502f | 53 | |
Artiom | 8:8aeb718824ea | 54 | int capteur_contact(void) |
Artiom | 8:8aeb718824ea | 55 | { |
Artiom | 8:8aeb718824ea | 56 | if(capteur_contact_block.read()==1) { |
Artiom | 0:bc74da1c502f | 57 | return 1; |
Artiom | 8:8aeb718824ea | 58 | } else { |
Artiom | 0:bc74da1c502f | 59 | return 0; |
Artiom | 0:bc74da1c502f | 60 | } |
Artiom | 0:bc74da1c502f | 61 | } |