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.
Fork of test_carteAToutFaire_PR by
main.cpp
00001 #include "all_includes.h" 00002 00003 Timer t; 00004 Ticker flipper; 00005 00006 CAN can(p30,p29); // Rx&Tx pour le CAN 00007 CANMessage msgRxBuffer[SIZE_FIFO]; // buffer en réception pour le CAN 00008 00009 Serial pc(USBTX, USBRX); 00010 00011 extern void gerer_turbine(unsigned char pwm_turbine); 00012 00013 00014 PwmOut PompeDroite(p21); 00015 //PwmOut PompeGauche(p22); 00016 PwmOut MotLanceur(p22); 00017 PwmOut turbine(p23); 00018 //PwmOut ServoVanne(p21); 00019 00020 AnalogIn telemetre(p15); 00021 00022 DigitalIn Jack(p25); 00023 00024 00025 DigitalOut led(LED1); 00026 DigitalOut led2(LED2); 00027 00028 unsigned char EtatPompeDroite=0, EtatPompeGauche=0, EtatLanceur=0, EtatAx12=0, ChoixBras=0, ActionAx12=0, EtatTurbine=0, EtatServoVanne=0; 00029 unsigned char action_a_effectuer=0, ActionPompe=0; 00030 00031 00032 /* 00033 DigitalIn IO1(p23); 00034 DigitalIn IO2(p24); 00035 DigitalIn IO3(p25); 00036 DigitalIn IO4(p26); 00037 00038 AnalogIn A_in1(p15); 00039 AnalogIn A_in2(p16); 00040 AnalogIn A_in3(p17); 00041 AnalogIn A_in4(p18); 00042 AnalogIn A_in5(p19); 00043 AnalogIn A_in6(p20); 00044 00045 PwmOut IRL_1(p21); 00046 PwmOut IRL_2(p22); 00047 */ 00048 00049 00050 00051 00052 int main() { 00053 00054 can.frequency(1000000); // fréquence de travail 1Mbit/s 00055 can.attach(&canRx_ISR); // création de l'interrupt attachée à la réception sur le CAN 00056 00057 00058 // message CAN autorise a declencher l'interruption 00059 00060 CAN2_wrFilter(POMPE_DROITE); 00061 CAN2_wrFilter(POMPE_GAUCHE); 00062 00063 CAN2_wrFilter(LANCEUR); 00064 CAN2_wrFilter(TURBINE); 00065 CAN2_wrFilter(SERVOVANNE); 00066 CAN2_wrFilter(0x123); 00067 00068 CAN2_wrFilter(SERVO_AX12_ACTION); 00069 CAN2_wrFilter(SERVO_AX12_ACK); 00070 CAN2_wrFilter(SERVO_AX12_END); 00071 CAN2_wrFilter(CHECK_AX12); 00072 00073 initialisation_AX12(); 00074 00075 PompeDroite.period(0.001); 00076 //PompeGauche.period(0.001); 00077 MotLanceur.period(0.001); 00078 // ServoVanne.period(0.001); 00079 00080 00081 while(1) { 00082 led = !led; 00083 canProcessRx();//Traitement des trames CAN en attente 00084 00085 00086 if (action_a_effectuer==1) { 00087 00088 action_a_effectuer=0; 00089 00090 if (ActionAx12==1){ 00091 AX12_automate(EtatAx12, ChoixBras); 00092 ActionAx12=0; 00093 } 00094 00095 if ((EtatPompeDroite==1)&&(ActionPompe==1)) 00096 ActionPompe=0, PompeDroite.write(1); 00097 else if ((EtatPompeDroite==0)&&(ActionPompe==1)) 00098 PompeDroite.write(0), ActionPompe=0; 00099 00100 /* 00101 if (EtatPompeGauche==1) 00102 PompeGauche.write(1); 00103 else if (EtatPompeGauche==0) 00104 PompeGauche.write(0); 00105 */ 00106 00107 if (EtatTurbine==1) 00108 gerer_turbine(20); 00109 else if (EtatTurbine==0) 00110 gerer_turbine(0); 00111 00112 if (EtatLanceur==1) 00113 MotLanceur.write(1); 00114 else if (EtatLanceur==0) 00115 MotLanceur.write(0); 00116 /* 00117 if (EtatServoVanne==1) 00118 ServoVanne.write(0.4); 00119 if (EtatServoVanne==0) 00120 ServoVanne.write(0); 00121 */ 00122 } 00123 00124 } 00125 } 00126
Generated on Fri Jul 15 2022 17:28:29 by
1.7.2
