Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 /* Équipe : Ares ENSEA 00002 * Coupe de France de robotique 2020 00003 */ 00004 00005 00006 /* #include */ 00007 #include "pins.h" 00008 00009 00010 /* Variables globales */ 00011 Ticker TickerGlobal; // Comptage du temps écoulé 00012 int cptGlobal = 0; 00013 bool match = 0; // Match == 1 => Le match est en cours 00014 00015 00016 /* Prototypes */ 00017 void btnBlueIT(); 00018 void globalCounterIT(); 00019 00020 00021 int main() 00022 { 00023 pc.printf("\r\nAresCDF2020\r\n"); 00024 bt.printf("\r\nAresCDF2020\r\n"); 00025 00026 /* Initialisation des drivers */ 00027 drv_init(); 00028 00029 /* Initialisation des codeurs */ 00030 cdgA.rise(&cdgaRise); 00031 cddA.rise(&cddaRise); 00032 cdgA.mode(PullUp); 00033 cddA.mode(PullUp); 00034 00035 /* Initialisation des broches */ 00036 Tirette.mode(PullDown); 00037 00038 /* Initialisation des pavillons */ 00039 FlagGOTO(90); 00040 00041 /* Timers & tickers */ 00042 TickerGlobal.attach(&globalCounterIT, 1.0); 00043 TimUS.start(); 00044 00045 TickUS_actu.attach(&captUS_trig,0.2); 00046 Ticker_asserv.attach(&asserv,0.015); 00047 //Ticker_affUS.attach(&affUltrasons,1.0); 00048 00049 /* Initialisation des capteurs à ultrasons */ 00050 echo1.rise(&echoRise1); // Interruptions pour les capteurs à ultrasons 00051 echo1.fall(&echoFall1); 00052 echo2.rise(&echoRise2); 00053 echo2.fall(&echoFall2); 00054 echo3.rise(&echoRise3); 00055 echo3.fall(&echoFall3); 00056 echo4.rise(&echoRise4); 00057 echo4.fall(&echoFall4); 00058 echo5.rise(&echoRise5); 00059 echo5.fall(&echoFall5); 00060 echo6.rise(&echoRise6); 00061 echo6.fall(&echoFall6); 00062 00063 /* debug */ 00064 pc.attach(&serialIT); // Interruption liaison série 00065 bt.attach(&bluetoothIT); // Interruption bluetooth 00066 pc.baud(9600); 00067 pc.format(8,SerialBase::None,1); 00068 bt.baud(9600); 00069 bt.format(8,SerialBase::None,1); 00070 00071 /* Autres */ 00072 //btnBlue.rise(&boutonBleu); 00073 00074 /* Boucle infinie */ 00075 while(1) { 00076 if (Tirette == 1 && match == 0) { // Stand-by 00077 // Le match n'a pas encore commencé 00078 // La LED est allumée 00079 // Le compteur du match reste à 0 00080 Led = 1; 00081 match = 0; 00082 cptGlobal=0; 00083 } 00084 00085 else if (Tirette == 0 && match == 0) { // Début du match 00086 // Le match débute 00087 // La LED s'éteind 00088 Led = 0; 00089 match = 1; 00090 cptGlobal = 0; 00091 00092 indice= 1; 00093 fnc = objEtape[indice]; 00094 xC = objX[indice]; 00095 yC = objY[indice]; 00096 } 00097 00098 if (indice>=NbObj) { 00099 fnc = 0; 00100 } 00101 } 00102 } 00103 00104 void btnBlueIT() 00105 { 00106 /* Rien */ 00107 } 00108 00109 void globalCounterIT() 00110 { 00111 cptGlobal++; 00112 00113 if(cptGlobal==95) { // Le drapeau doit être hissé à 95sec 00114 FlagGOTO(0); 00115 } 00116 00117 if(cptGlobal>=100) { // Le robot doit s'arrêter à 100sec 00118 fnc=0; 00119 } 00120 }
Generated on Wed Jul 20 2022 11:03:38 by
1.7.2