Classes et code de la partie pompe du Robot 2021

Dependencies:   mbed ident_crac

Committer:
goldmas
Date:
Fri Jan 15 07:36:28 2021 +0000
Revision:
0:253443d82cba
Child:
4:4bae30d48662
Code pour les pompes Coupe de France de robotique 2021

Who changed what in which revision?

UserRevisionLine numberNew contents of line
goldmas 0:253443d82cba 1 #include "bloc_8_pompe.h"
goldmas 0:253443d82cba 2
goldmas 0:253443d82cba 3 bloc_monopompe bloc1(PC_9, PA_8, PB_0) ;
goldmas 0:253443d82cba 4 bloc_monopompe bloc2(PA_9, PA_10, PB_1) ;
goldmas 0:253443d82cba 5 bloc_monopompe bloc3(PA_11, PA_15, PC_1) ;
goldmas 0:253443d82cba 6 bloc_monopompe bloc4(PB_7, PB_6, PC_0) ;
goldmas 0:253443d82cba 7 bloc_monopompe bloc5(PC_7, PC_8, PC_5) ;
goldmas 0:253443d82cba 8 bloc_monopompe bloc6(PB_10, PB_2, PC_4) ;
goldmas 0:253443d82cba 9 bloc_monopompe bloc7(PA_6, PA_5, PA_7) ;
goldmas 0:253443d82cba 10 bloc_monopompe bloc8(PA_0, PA_1, PA_4) ;
goldmas 0:253443d82cba 11
goldmas 0:253443d82cba 12
goldmas 0:253443d82cba 13 bloc_8_pompe::bloc_8_pompe (PinName pompe1, PinName electrovanne1, PinName capteur1,
goldmas 0:253443d82cba 14 PinName pompe2, PinName electrovanne2, PinName capteur2,
goldmas 0:253443d82cba 15 PinName pompe3, PinName electrovanne3, PinName capteur3,
goldmas 0:253443d82cba 16 PinName pompe4, PinName electrovanne4, PinName capteur4,
goldmas 0:253443d82cba 17 PinName pompe5, PinName electrovanne5, PinName capteur5,
goldmas 0:253443d82cba 18 PinName pompe6, PinName electrovanne6, PinName capteur6,
goldmas 0:253443d82cba 19 PinName pompe7, PinName electrovanne7, PinName capteur7,
goldmas 0:253443d82cba 20 PinName pompe8, PinName electrovanne8, PinName capteur8)
goldmas 0:253443d82cba 21 : _pompe1 (pompe1), _electrovanne1 (electrovanne1), _capteur1 (capteur1),
goldmas 0:253443d82cba 22 _pompe2 (pompe2), _electrovanne2 (electrovanne2), _capteur2 (capteur2),
goldmas 0:253443d82cba 23 _pompe3 (pompe3), _electrovanne3 (electrovanne3), _capteur3 (capteur3),
goldmas 0:253443d82cba 24 _pompe4 (pompe4), _electrovanne4 (electrovanne4), _capteur4 (capteur4),
goldmas 0:253443d82cba 25 _pompe5 (pompe5), _electrovanne5 (electrovanne5), _capteur5 (capteur5),
goldmas 0:253443d82cba 26 _pompe6 (pompe6), _electrovanne6 (electrovanne6), _capteur6 (capteur6),
goldmas 0:253443d82cba 27 _pompe7 (pompe7), _electrovanne7 (electrovanne7), _capteur7 (capteur7),
goldmas 0:253443d82cba 28 _pompe8 (pompe8), _electrovanne8 (electrovanne8), _capteur8 (capteur8)
goldmas 0:253443d82cba 29 {
goldmas 0:253443d82cba 30 _pompe1.period_us(20) ;
goldmas 0:253443d82cba 31 _pompe2.period_us(20) ;
goldmas 0:253443d82cba 32 _pompe3.period_us(20) ;
goldmas 0:253443d82cba 33 _pompe4.period_us(20) ;
goldmas 0:253443d82cba 34 _pompe5.period_us(20) ;
goldmas 0:253443d82cba 35 _pompe6.period_us(20) ;
goldmas 0:253443d82cba 36 _pompe7.period_us(20) ;
goldmas 0:253443d82cba 37 _pompe8.period_us(20) ;
goldmas 0:253443d82cba 38 }
goldmas 0:253443d82cba 39
goldmas 0:253443d82cba 40 bool bloc_8_pompe::aspirer (int groupe = 1)
goldmas 0:253443d82cba 41 {
goldmas 0:253443d82cba 42 switch (groupe)
goldmas 0:253443d82cba 43 {
goldmas 0:253443d82cba 44 case 1 :
goldmas 0:253443d82cba 45 _gobelet_en_place[groupe-1] = bloc1.aspirer() ;
goldmas 0:253443d82cba 46 break;
goldmas 0:253443d82cba 47
goldmas 0:253443d82cba 48 case 2 :
goldmas 0:253443d82cba 49 _gobelet_en_place[groupe-1] = bloc2.aspirer() ;
goldmas 0:253443d82cba 50 break;
goldmas 0:253443d82cba 51
goldmas 0:253443d82cba 52 case 3 :
goldmas 0:253443d82cba 53 _gobelet_en_place[groupe-1] = bloc3.aspirer() ;
goldmas 0:253443d82cba 54 break;
goldmas 0:253443d82cba 55
goldmas 0:253443d82cba 56 case 4 :
goldmas 0:253443d82cba 57 _gobelet_en_place[groupe-1] = bloc4.aspirer() ;
goldmas 0:253443d82cba 58 break;
goldmas 0:253443d82cba 59
goldmas 0:253443d82cba 60 case 5 :
goldmas 0:253443d82cba 61 _gobelet_en_place[groupe-1] = bloc5.aspirer() ;
goldmas 0:253443d82cba 62 break;
goldmas 0:253443d82cba 63
goldmas 0:253443d82cba 64 case 6 :
goldmas 0:253443d82cba 65 _gobelet_en_place[groupe-1] = bloc6.aspirer() ;
goldmas 0:253443d82cba 66 break;
goldmas 0:253443d82cba 67
goldmas 0:253443d82cba 68 case 7 :
goldmas 0:253443d82cba 69 _gobelet_en_place[groupe-1] = bloc7.aspirer() ;
goldmas 0:253443d82cba 70 break;
goldmas 0:253443d82cba 71
goldmas 0:253443d82cba 72 case 8 :
goldmas 0:253443d82cba 73 _gobelet_en_place[groupe-1] = bloc8.aspirer() ;
goldmas 0:253443d82cba 74 break;
goldmas 0:253443d82cba 75 }
goldmas 0:253443d82cba 76 return _gobelet_en_place[groupe-1] ;
goldmas 0:253443d82cba 77 }
goldmas 0:253443d82cba 78
goldmas 0:253443d82cba 79 bool bloc_8_pompe::relacher (int groupe = 1)
goldmas 0:253443d82cba 80 {
goldmas 0:253443d82cba 81 switch (groupe)
goldmas 0:253443d82cba 82 {
goldmas 0:253443d82cba 83 case 1 :
goldmas 0:253443d82cba 84 _gobelet_en_place[groupe-1] = bloc1.relacher() ;
goldmas 0:253443d82cba 85 break;
goldmas 0:253443d82cba 86
goldmas 0:253443d82cba 87 case 2 :
goldmas 0:253443d82cba 88 _gobelet_en_place[groupe-1] = bloc2.relacher() ;
goldmas 0:253443d82cba 89 break;
goldmas 0:253443d82cba 90
goldmas 0:253443d82cba 91 case 3 :
goldmas 0:253443d82cba 92 _gobelet_en_place[groupe-1] = bloc3.relacher() ;
goldmas 0:253443d82cba 93 break;
goldmas 0:253443d82cba 94
goldmas 0:253443d82cba 95 case 4 :
goldmas 0:253443d82cba 96 _gobelet_en_place[groupe-1] = bloc4.relacher() ;
goldmas 0:253443d82cba 97 break;
goldmas 0:253443d82cba 98
goldmas 0:253443d82cba 99 case 5 :
goldmas 0:253443d82cba 100 _gobelet_en_place[groupe-1] = bloc5.relacher() ;
goldmas 0:253443d82cba 101 break;
goldmas 0:253443d82cba 102
goldmas 0:253443d82cba 103 case 6 :
goldmas 0:253443d82cba 104 _gobelet_en_place[groupe-1] = bloc6.relacher() ;
goldmas 0:253443d82cba 105 break;
goldmas 0:253443d82cba 106
goldmas 0:253443d82cba 107 case 7 :
goldmas 0:253443d82cba 108 _gobelet_en_place[groupe-1] = bloc7.relacher() ;
goldmas 0:253443d82cba 109 break;
goldmas 0:253443d82cba 110
goldmas 0:253443d82cba 111 case 8 :
goldmas 0:253443d82cba 112 _gobelet_en_place[groupe-1] = bloc8.relacher() ;
goldmas 0:253443d82cba 113 break;
goldmas 0:253443d82cba 114 }
goldmas 0:253443d82cba 115 return _gobelet_en_place[groupe-1] ;
goldmas 0:253443d82cba 116 }
goldmas 0:253443d82cba 117
goldmas 0:253443d82cba 118 bool bloc_8_pompe::possession (int groupe = 1)
goldmas 0:253443d82cba 119 {
goldmas 0:253443d82cba 120 switch (groupe)
goldmas 0:253443d82cba 121 {
goldmas 0:253443d82cba 122 case 1 :
goldmas 0:253443d82cba 123 _gobelet_en_place[groupe-1] = bloc1.possession() ;
goldmas 0:253443d82cba 124 break;
goldmas 0:253443d82cba 125
goldmas 0:253443d82cba 126 case 2 :
goldmas 0:253443d82cba 127 _gobelet_en_place[groupe-1] = bloc2.possession() ;
goldmas 0:253443d82cba 128 break;
goldmas 0:253443d82cba 129
goldmas 0:253443d82cba 130 case 3 :
goldmas 0:253443d82cba 131 _gobelet_en_place[groupe-1] = bloc3.possession() ;
goldmas 0:253443d82cba 132 break;
goldmas 0:253443d82cba 133
goldmas 0:253443d82cba 134 case 4 :
goldmas 0:253443d82cba 135 _gobelet_en_place[groupe-1] = bloc4.possession() ;
goldmas 0:253443d82cba 136 break;
goldmas 0:253443d82cba 137
goldmas 0:253443d82cba 138 case 5 :
goldmas 0:253443d82cba 139 _gobelet_en_place[groupe-1] = bloc5.possession() ;
goldmas 0:253443d82cba 140 break;
goldmas 0:253443d82cba 141
goldmas 0:253443d82cba 142 case 6 :
goldmas 0:253443d82cba 143 _gobelet_en_place[groupe-1] = bloc6.possession() ;
goldmas 0:253443d82cba 144 break;
goldmas 0:253443d82cba 145
goldmas 0:253443d82cba 146 case 7 :
goldmas 0:253443d82cba 147 _gobelet_en_place[groupe-1] = bloc7.possession() ;
goldmas 0:253443d82cba 148 break;
goldmas 0:253443d82cba 149
goldmas 0:253443d82cba 150 case 8 :
goldmas 0:253443d82cba 151 _gobelet_en_place[groupe-1] = bloc8.possession() ;
goldmas 0:253443d82cba 152 break;
goldmas 0:253443d82cba 153 }
goldmas 0:253443d82cba 154 return _gobelet_en_place[groupe-1] ;
goldmas 0:253443d82cba 155 }
goldmas 0:253443d82cba 156